SYSLOG: more places to correct the loglevel parameters.
[citadel.git] / webcit / sysdep.c
index 0c0ac90e21c6f46c17580b08823666cf2de16254..6c0efa49b918a1941eb5a3049fb88c7fa657386a 100644 (file)
@@ -104,7 +104,7 @@ void InitialiseSemaphores(void)
 
        if (pipe(ExitPipe))
        {
-               syslog(2, "Failed to open exit pipe: %d [%s]\n", 
+               syslog(LOG_WARNING, "Failed to open exit pipe: %d [%s]\n", 
                       errno, 
                       strerror(errno));
                
@@ -195,17 +195,17 @@ void worker_entry(void)
                        if (shutdown == 1)
                        {/* we're the one to cleanup the mess. */
                                http_destroy_modules(&Hdr);
-                               syslog(2, "I'm master shutdown: tagging sessions to be killed.\n");
+                               syslog(LOG_DEBUG, "I'm master shutdown: tagging sessions to be killed.\n");
                                shutdown_sessions();
-                               syslog(2, "master shutdown: waiting for others\n");
+                               syslog(LOG_DEBUG, "master shutdown: waiting for others\n");
                                sleeeeeeeeeep(1); /* wait so some others might finish... */
-                               syslog(2, "master shutdown: cleaning up sessions\n");
+                               syslog(LOG_DEBUG, "master shutdown: cleaning up sessions\n");
                                do_housekeeping();
-                               syslog(2, "master shutdown: cleaning up libical\n");
+                               syslog(LOG_DEBUG, "master shutdown: cleaning up libical\n");
 
                                ShutDownWebcit();
 
-                               syslog(2, "master shutdown exiting.\n");                                
+                               syslog(LOG_DEBUG, "master shutdown exiting.\n");                                
                                exit(0);
                        }
                        break;
@@ -217,7 +217,7 @@ void worker_entry(void)
                /* Now do something. */
                if (msock < 0) {
                        if (ssock > 0) close (ssock);
-                       syslog(2, "in between.");
+                       syslog(LOG_DEBUG, "in between.");
                        pthread_exit(NULL);
                } else {
                        /* Got it? do some real work! */
@@ -239,11 +239,11 @@ void worker_entry(void)
                                int fdflags; 
                                fdflags = fcntl(ssock, F_GETFL);
                                if (fdflags < 0)
-                                       syslog(1, "unable to get server socket flags! %s \n",
+                                       syslog(LOG_WARNING, "unable to get server socket flags! %s \n",
                                                strerror(errno));
                                fdflags = fdflags | O_NONBLOCK;
                                if (fcntl(ssock, F_SETFL, fdflags) < 0)
-                                       syslog(1, "unable to set server socket nonblocking flags! %s \n",
+                                       syslog(LOG_WARNING, "unable to set server socket nonblocking flags! %s \n",
                                                strerror(errno));
                        }
 
@@ -273,7 +273,7 @@ void worker_entry(void)
        } while (!time_to_die);
 
        http_destroy_modules(&Hdr);
-       syslog(1, "Thread exiting.\n");
+       syslog(LOG_DEBUG, "Thread exiting.\n");
        pthread_exit(NULL);
 }
 
@@ -284,7 +284,7 @@ void worker_entry(void)
  */
 pid_t current_child;
 void graceful_shutdown_watcher(int signum) {
-       syslog(1, "Watcher thread exiting.\n");
+       syslog(LOG_INFO, "Watcher thread exiting.\n");
        write(ExitPipe[0], HKEY("                              "));
        kill(current_child, signum);
        if (signum != SIGHUP)
@@ -301,7 +301,7 @@ void graceful_shutdown(int signum) {
        FILE *FD;
        int fd;
 
-       syslog(1, "WebCit is being shut down on signal %d.\n", signum);
+       syslog(LOG_INFO, "WebCit is being shut down on signal %d.\n", signum);
        fd = msock;
        msock = -1;
        time_to_die = 1;
@@ -431,13 +431,13 @@ void spawn_another_worker_thread()
         * otherwise the MIME parser crashes on FreeBSD.
         */
        if ((ret = pthread_attr_setstacksize(&attr, 1024 * 1024))) {
-               syslog(1, "pthread_attr_setstacksize: %s\n", strerror(ret));
+               syslog(LOG_WARNING, "pthread_attr_setstacksize: %s\n", strerror(ret));
                pthread_attr_destroy(&attr);
        }
 
        /* now create the thread */
        if (pthread_create(&SessThread, &attr, (void *(*)(void *)) worker_entry, NULL) != 0) {
-               syslog(1, "Can't create thread: %s\n", strerror(errno));
+               syslog(LOG_WARNING, "Can't create thread: %s\n", strerror(errno));
        }
 
        /* free up the attributes */
@@ -487,7 +487,7 @@ webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdi
                 ctdl_key_dir);
 
        /* we should go somewhere we can leave our coredump, if enabled... */
-       syslog(9, "Changing directory to %s\n", socket_dir);
+       syslog(LOG_INFO, "Changing directory to %s\n", socket_dir);
        if (chdir(webcitdir) != 0) {
                perror("chdir");
        }
@@ -537,7 +537,7 @@ void drop_root(uid_t UID)
 /*
  * print the actual stack frame.
  */
-void wc_backtrace(void)
+void wc_backtrace(long LogLevel)
 {
 #ifdef HAVE_BACKTRACE
        void *stack_frames[50];
@@ -549,9 +549,9 @@ void wc_backtrace(void)
        strings = backtrace_symbols(stack_frames, size);
        for (i = 0; i < size; i++) {
                if (strings != NULL)
-                       syslog(1, "%s\n", strings[i]);
+                       syslog(LogLevel, "%s\n", strings[i]);
                else
-                       syslog(1, "%p\n", stack_frames[i]);
+                       syslog(LogLevel, "%p\n", stack_frames[i]);
        }
        free(strings);
 #endif