]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/log.c
New configuration option "SyslogFacility"
[ngircd-alex.git] / src / ngircd / log.c
index 439ca41fb5a5905b58466ab15a39ba9354f6b727..3710142d81e4d0a57f2a50bf84760ddc3efcd955 100644 (file)
@@ -34,9 +34,9 @@
 #include "ngircd.h"
 #include "defines.h"
 #include "conn.h"
-#include "client.h"
 #include "channel.h"
 #include "irc-write.h"
+#include "conf.h"
 
 #include "exp.h"
 #include "log.h"
@@ -73,13 +73,10 @@ Log_Init( bool Daemon_Mode )
        Is_Daemon = Daemon_Mode;
        
 #ifdef SYSLOG
-#ifndef LOG_CONS     /* Kludge: mips-dec-ultrix4.5 has no LOG_CONS/LOG_LOCAL5 */
+#ifndef LOG_CONS     /* Kludge: mips-dec-ultrix4.5 has no LOG_CONS */
 #define LOG_CONS 0
 #endif
-#ifndef LOG_LOCAL5
-#define LOG_LOCAL5 0
-#endif
-       openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
+       openlog(PACKAGE_NAME, LOG_CONS|LOG_PID, Conf_SyslogFacility);
 #endif
 
        Log( LOG_NOTICE, "%s started.", NGIRCd_Version );
@@ -265,64 +262,65 @@ va_dcl
 
 
 GLOBAL void
-Log_Init_Resolver( void )
+Log_Init_Subprocess(char UNUSED *Name)
 {
 #ifdef SYSLOG
-       openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
+       openlog(PACKAGE_NAME, LOG_CONS|LOG_PID, Conf_SyslogFacility);
 #endif
 #ifdef DEBUG
-       Log_Resolver(LOG_DEBUG, "Resolver sub-process starting, PID %ld.", (long)getpid());
+       Log_Subprocess(LOG_DEBUG, "%s sub-process starting, PID %ld.",
+                    Name, (long)getpid());
 #endif
-} /* Log_Init_Resolver */
+}
 
 
 GLOBAL void
-Log_Exit_Resolver( void )
+Log_Exit_Subprocess(char UNUSED *Name)
 {
 #ifdef DEBUG
-       Log_Resolver(LOG_DEBUG, "Resolver sub-process %ld done.", (long)getpid());
+       Log_Subprocess(LOG_DEBUG, "%s sub-process %ld done.",
+                    Name, (long)getpid());
 #endif
 #ifdef SYSLOG
        closelog( );
 #endif
-} /* Log_Exit_Resolver */
+}
 
 
 #ifdef PROTOTYPES
 GLOBAL void
-Log_Resolver( const int Level, const char *Format, ... )
+Log_Subprocess(const int Level, const char *Format, ...)
 #else
 GLOBAL void
-Log_Resolver( Level, Format, va_alist )
+Log_Subprocess(Level, Format, va_alist)
 const int Level;
 const char *Format;
 va_dcl
 #endif
 {
-       /* Eintrag des Resolver in Logfile(s) schreiben */
-
        char msg[MAX_LOG_MSG_LEN];
        va_list ap;
 
-       assert( Format != NULL );
+       assert(Format != NULL);
 
 #ifdef DEBUG
-       if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
+       if ((Level == LOG_DEBUG) && (!NGIRCd_Debug))
+               return;
 #else
-       if( Level == LOG_DEBUG ) return;
+       if (Level == LOG_DEBUG)
+               return;
 #endif
 
-       /* String mit variablen Argumenten zusammenbauen ... */
 #ifdef PROTOTYPES
-       va_start( ap, Format );
+       va_start(ap, Format);
 #else
-       va_start( ap );
+       va_start(ap);
 #endif
-       vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
-       va_end( ap );
+       vsnprintf(msg, MAX_LOG_MSG_LEN, Format, ap);
+       va_end(ap);
 
        Log_Message(Level, msg);
-} /* Log_Resolver */
+}
 
 
 /**