mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-13 10:20:28 +00:00
Added PID to all log messages on the console; enhanced logging of
resolver sub-processes in debug mode.
This commit is contained in:
parent
cdb039672c
commit
26390c60fb
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: log.c,v 1.45 2004/05/07 11:19:21 alex Exp $";
|
static char UNUSED id[] = "$Id: log.c,v 1.46 2004/05/10 23:57:46 alex Exp $";
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -182,7 +182,7 @@ va_dcl
|
|||||||
if( NGIRCd_NoDaemon )
|
if( NGIRCd_NoDaemon )
|
||||||
{
|
{
|
||||||
/* auf Konsole ausgeben */
|
/* auf Konsole ausgeben */
|
||||||
fprintf( stdout, "[%d] %s\n", Level, msg );
|
fprintf( stdout, "[%d:%d] %s\n", getpid( ), Level, msg );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
}
|
}
|
||||||
#ifdef SYSLOG
|
#ifdef SYSLOG
|
||||||
@ -214,12 +214,14 @@ Log_Init_Resolver( VOID )
|
|||||||
#ifdef SYSLOG
|
#ifdef SYSLOG
|
||||||
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
|
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
|
||||||
#endif
|
#endif
|
||||||
|
Log_Resolver( LOG_DEBUG, "Resolver sub-process starting, PID %d.", getpid( ));
|
||||||
} /* Log_Init_Resolver */
|
} /* Log_Init_Resolver */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL VOID
|
GLOBAL VOID
|
||||||
Log_Exit_Resolver( VOID )
|
Log_Exit_Resolver( VOID )
|
||||||
{
|
{
|
||||||
|
Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( ));
|
||||||
#ifdef SYSLOG
|
#ifdef SYSLOG
|
||||||
closelog( );
|
closelog( );
|
||||||
#endif
|
#endif
|
||||||
@ -239,17 +241,11 @@ va_dcl
|
|||||||
{
|
{
|
||||||
/* Eintrag des Resolver in Logfile(s) schreiben */
|
/* Eintrag des Resolver in Logfile(s) schreiben */
|
||||||
|
|
||||||
#ifndef SYSLOG
|
|
||||||
return;
|
|
||||||
#else
|
|
||||||
|
|
||||||
CHAR msg[MAX_LOG_MSG_LEN];
|
CHAR msg[MAX_LOG_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
assert( Format != NULL );
|
assert( Format != NULL );
|
||||||
|
|
||||||
if( NGIRCd_NoDaemon ) return;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
|
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
|
||||||
#else
|
#else
|
||||||
@ -265,9 +261,15 @@ va_dcl
|
|||||||
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
|
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
/* ... und ausgeben */
|
/* Output */
|
||||||
syslog( Level, msg );
|
if( NGIRCd_NoDaemon )
|
||||||
|
{
|
||||||
|
/* Output to console */
|
||||||
|
fprintf( stdout, "[%d:%d] %s\n", getpid( ), Level, msg );
|
||||||
|
fflush( stdout );
|
||||||
|
}
|
||||||
|
#ifdef SYSLOG
|
||||||
|
else syslog( Level, msg );
|
||||||
#endif
|
#endif
|
||||||
} /* Log_Resolver */
|
} /* Log_Resolver */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user