#include "portab.h"
-static char UNUSED id[] = "$Id: log.c,v 1.48 2004/10/20 13:47:32 alex Exp $";
+static char UNUSED id[] = "$Id: log.c,v 1.52 2005/02/10 12:49:04 alex Exp $";
#include "imp.h"
#include <assert.h>
#include "log.h"
-LOCAL CHAR Error_File[FNAME_LEN];
LOCAL CHAR Init_Txt[127];
+#ifdef DEBUG
+LOCAL CHAR Error_File[FNAME_LEN];
+#endif
+
LOCAL VOID Wall_ServerNotice PARAMS(( CHAR *Msg ));
#endif
/* Hello World! */
- Log( LOG_NOTICE, "%s started.", NGIRCd_Version( ));
+ Log( LOG_NOTICE, "%s started.", NGIRCd_Version );
/* Informationen uebern den "Operation Mode" */
- strcpy( Init_Txt, "" );
+ Init_Txt[0] = '\0';
#ifdef DEBUG
if( NGIRCd_Debug )
{
- if( Init_Txt[0] ) strcat( Init_Txt, ", " );
- strcat( Init_Txt, "debug-mode" );
+ strcpy( Init_Txt, "debug-mode" );
}
#endif
if( NGIRCd_NoDaemon )
#endif
if( Init_Txt[0] ) Log( LOG_INFO, "Activating: %s.", Init_Txt );
+#ifdef DEBUG
Error_File[0] = '\0';
+#endif
} /* Log_Init */
+#ifdef DEBUG
+
GLOBAL VOID
Log_InitErrorfile( VOID )
{
/* Einige Infos in das Error-File schreiben */
fputs( ctime( &NGIRCd_Start ), stderr );
- fprintf( stderr, "%s started.\n", NGIRCd_Version( ));
+ fprintf( stderr, "%s started.\n", NGIRCd_Version );
fprintf( stderr, "Activating: %s\n\n", Init_Txt[0] ? Init_Txt : "-" );
fflush( stderr );
Log( LOG_DEBUG, "Redirected stderr to \"%s\".", Error_File );
} /* Log_InitErrfile */
+#endif
+
GLOBAL VOID
Log_Exit( VOID )
if( NGIRCd_SignalRestart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE_NAME );
else Log( LOG_NOTICE, "%s done.", PACKAGE_NAME );
+#ifdef DEBUG
if( Error_File[0] )
{
/* Error-File (stderr) loeschen */
if( unlink( Error_File ) != 0 ) Log( LOG_ERR, "Can't delete \"%s\": %s", Error_File, strerror( errno ));
}
+#endif
#ifdef SYSLOG
/* syslog abmelden */
if( Level <= LOG_CRIT )
{
- /* Kritische Meldungen in Error-File (stderr) */
+ /* log critical messages to stderr */
fprintf( stderr, "%s\n", msg );
fflush( stderr );
}
fflush( stdout );
}
#ifdef SYSLOG
- else syslog( Level, msg );
+ else syslog( Level, "%s", msg );
#endif
} /* Log_Resolver */