commit - 4b83a23d9d3aa4644dc497f14eaca2bd7f1cc347
commit + d26a283ea9ae86c5c4633a46aaec69b02def7c66
blob - d450bd0a2ee543e58bd448c10c87f15e04b4beee
blob + 5559a2c6ada62e176d1e39ac0f3fda7d6dc4cb09
--- src/ngircd/log.c
+++ src/ngircd/log.c
#include "portab.h"
-static char UNUSED id[] = "$Id: log.c,v 1.62 2006/08/05 09:16:21 fw Exp $";
-
#include "imp.h"
#include <assert.h>
#include <errno.h>
static void Wall_ServerNotice PARAMS(( char *Msg ));
+
+static void
+Log_Message(int Level, const char *msg)
+{
+ if (!Is_Daemon) {
+ /* log to console */
+ fprintf(stdout, "[%ld:%d %4ld] %s\n", (long)getpid(), Level,
+ (long)time(NULL) - NGIRCd_Start, msg);
+ fflush(stdout);
+ }
+#ifdef SYSLOG
+ else {
+ syslog(Level, "%s", msg);
+ }
+#endif
+}
GLOBAL void
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
va_end( ap );
- if (!Is_Daemon) {
- /* log to console */
- fprintf(stdout, "[%d:%d %4ld] %s\n", (int)getpid( ), Level,
- time(NULL) - NGIRCd_Start, msg);
- fflush(stdout);
- }
-#ifdef SYSLOG
- else
- {
- /* Syslog */
- syslog( Level, "%s", msg );
- }
-#endif
+ Log_Message(Level, msg);
- if( Level <= LOG_CRIT )
- {
+ if (Level <= LOG_CRIT) {
/* log critical messages to stderr */
- fprintf( stderr, "%s\n", msg );
- fflush( stderr );
+ fprintf(stderr, "%s\n", msg);
+ fflush(stderr);
}
if (snotice) {
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
#endif
#ifdef DEBUG
- Log_Resolver( LOG_DEBUG, "Resolver sub-process starting, PID %d.", getpid( ));
+ Log_Resolver(LOG_DEBUG, "Resolver sub-process starting, PID %ld.", (long)getpid());
#endif
} /* Log_Init_Resolver */
Log_Exit_Resolver( void )
{
#ifdef DEBUG
- Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( ));
+ Log_Resolver(LOG_DEBUG, "Resolver sub-process %ld done.", (long)getpid());
#endif
#ifdef SYSLOG
closelog( );
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
va_end( ap );
- if (!Is_Daemon) {
- /* Output to console */
- fprintf(stdout, "[%d:%d %4ld] %s\n", (int)getpid( ), Level,
- time(NULL) - NGIRCd_Start, msg);
- fflush(stdout);
- }
-#ifdef SYSLOG
- else syslog( Level, "%s", msg );
-#endif
+ Log_Message(Level, msg);
} /* Log_Resolver */