From 402796b55322167c3fa0d33d77eafb65761e4a59 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 23 Nov 2009 23:06:05 +0000 Subject: improved log-levels for various messages diff --git a/newfile.sh b/newfile.sh index 453b3d6..f4bd2e4 100755 --- a/newfile.sh +++ b/newfile.sh @@ -9,6 +9,6 @@ fi echo "new file detected $DIR/$FILENAME" >> /tmp/newfile.log sleep 5 -rm $DIR/$FILENAME >> /tmp/newfile.log 2>&1 +rm -f $DIR/$FILENAME >> /tmp/newfile.log 2>&1 exit 0 \ No newline at end of file diff --git a/rhdropbox.c b/rhdropbox.c index 851d527..8403ae7 100644 --- a/rhdropbox.c +++ b/rhdropbox.c @@ -83,7 +83,7 @@ int process_watch(int inotify_fd, read_buffer_t* buffer, watch_list_t* watch_lst u_int32_t len = sizeof(struct inotify_event) + event->len; if(buffer->offset >= len) { char* path = watch_list_find_path(watch_lst, event->wd); - log_printf(INFO, "received event for %d (mask=0x%08X, cookie=0x%08X name[%u]='%s')", + log_printf(DEBUG, "received event for %d (mask=0x%08X, cookie=0x%08X name[%u]='%s')", event->wd, event->mask, event->cookie, event->len, event->len > 0 ? event->name : ""); if(event->mask & IN_DELETE_SELF || event->mask & IN_MOVE_SELF) { @@ -100,6 +100,7 @@ int process_watch(int inotify_fd, read_buffer_t* buffer, watch_list_t* watch_lst char buf[100]; snprintf(buf, 100, "new file in '%s', name='%s'", path, event->len > 0 ? event->name : ""); + log_printf(NOTICE, "%s, executed script %s", buf, opt->script_); client_t* client; int listener_cnt = 0; for(client = client_lst; client; client = client->next) diff --git a/sysexec.c b/sysexec.c index 46c0ffc..d8722f4 100644 --- a/sysexec.c +++ b/sysexec.c @@ -186,7 +186,7 @@ int rh_exec(const char* script, char* const argv[], char* const evp[], child_lis } close(pipefd[1]); - log_printf(NOTICE, "called script '%s' with pid %d", script, pid); + log_printf(INFO, "called script '%s' with pid %d", script, pid); return child_list_add(child_lst, pid, script, pipefd[0]); } @@ -214,17 +214,17 @@ int rh_waitpid(child_list_t* child_lst) if(select(child->err_fd_+1, &rfds, NULL, NULL, &tv) == 1) { int err = 0; if(read(child->err_fd_, (void*)(&err), sizeof(err)) >= sizeof(err)) { - log_printf(NOTICE, "script '%s' exec() error: %s", child->script_, strerror(err)); + log_printf(INFO, "script '%s' exec() error: %s", child->script_, strerror(err)); close(child->script_); return -1; } } if(WIFEXITED(status)) - log_printf(NOTICE, "script '%s' (pid %d) returned %d", child->script_, child->pid_, WEXITSTATUS(status)); + log_printf(INFO, "script '%s' (pid %d) returned %d", child->script_, child->pid_, WEXITSTATUS(status)); else if(WIFSIGNALED(status)) - log_printf(NOTICE, "script '%s' (pid %d) terminated after signal %d", child->script_, child->pid_, WTERMSIG(status)); + log_printf(INFO, "script '%s' (pid %d) terminated after signal %d", child->script_, child->pid_, WTERMSIG(status)); else - log_printf(ERROR, "executing script '%s' (pid %d): unkown error", child->script_, child->pid_); + log_printf(INFO, "executing script '%s' (pid %d): unkown error", child->script_, child->pid_); close(child->err_fd_); return status; -- cgit v0.10.2