2001-12-11 22:53:04 +01:00
|
|
|
/*
|
|
|
|
* ngIRCd -- The Next Generation IRC Daemon
|
2005-08-29 12:58:00 +02:00
|
|
|
* Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
|
2001-12-11 22:53:04 +01:00
|
|
|
*
|
2002-12-12 13:24:18 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* Please read the file COPYING, README and AUTHORS for more information.
|
2001-12-11 22:53:04 +01:00
|
|
|
*
|
2002-12-12 13:24:18 +01:00
|
|
|
* Logging functions
|
2001-12-11 22:53:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-03-12 15:37:51 +01:00
|
|
|
#include "portab.h"
|
2001-12-11 22:53:04 +01:00
|
|
|
|
2006-07-24 01:23:45 +02:00
|
|
|
static char UNUSED id[] = "$Id: log.c,v 1.61 2006/07/23 23:23:45 alex Exp $";
|
2002-12-12 13:24:18 +01:00
|
|
|
|
2002-03-12 15:37:51 +01:00
|
|
|
#include "imp.h"
|
2001-12-11 22:53:04 +01:00
|
|
|
#include <assert.h>
|
2002-03-06 16:36:04 +01:00
|
|
|
#include <errno.h>
|
2004-10-20 15:47:32 +02:00
|
|
|
#ifdef PROTOTYPES
|
|
|
|
# include <stdarg.h>
|
|
|
|
#else
|
|
|
|
# include <varargs.h>
|
|
|
|
#endif
|
2001-12-11 22:53:04 +01:00
|
|
|
#include <stdio.h>
|
2001-12-26 04:22:16 +01:00
|
|
|
#include <string.h>
|
2002-03-06 16:36:04 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
2001-12-27 02:44:49 +01:00
|
|
|
|
2003-12-26 16:55:07 +01:00
|
|
|
#ifdef SYSLOG
|
2001-12-13 00:31:24 +01:00
|
|
|
#include <syslog.h>
|
2001-12-27 02:44:49 +01:00
|
|
|
#endif
|
2001-12-11 22:53:04 +01:00
|
|
|
|
2002-01-11 15:45:37 +01:00
|
|
|
#include "ngircd.h"
|
2002-03-12 15:37:51 +01:00
|
|
|
#include "defines.h"
|
2002-05-27 15:09:26 +02:00
|
|
|
#include "conn.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "channel.h"
|
2002-03-27 21:53:30 +01:00
|
|
|
#include "irc-write.h"
|
2002-01-11 15:45:37 +01:00
|
|
|
|
2002-03-12 15:37:51 +01:00
|
|
|
#include "exp.h"
|
2001-12-11 22:53:04 +01:00
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
|
2005-07-31 22:13:07 +02:00
|
|
|
static char Init_Txt[127];
|
|
|
|
static bool Is_Daemon;
|
2002-03-29 21:59:22 +01:00
|
|
|
|
2005-02-10 13:49:04 +01:00
|
|
|
#ifdef DEBUG
|
2005-07-31 22:13:07 +02:00
|
|
|
static char Error_File[FNAME_LEN];
|
2005-02-10 13:49:04 +01:00
|
|
|
#endif
|
|
|
|
|
2005-06-24 21:55:10 +02:00
|
|
|
|
2005-07-31 22:13:07 +02:00
|
|
|
static void Wall_ServerNotice PARAMS(( char *Msg ));
|
2002-03-27 21:53:30 +01:00
|
|
|
|
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
2005-06-24 21:55:10 +02:00
|
|
|
Log_Init( bool Daemon_Mode )
|
2001-12-11 22:53:04 +01:00
|
|
|
{
|
2005-06-24 21:55:10 +02:00
|
|
|
Is_Daemon = Daemon_Mode;
|
|
|
|
|
2003-12-26 16:55:07 +01:00
|
|
|
#ifdef SYSLOG
|
2005-04-16 11:31:30 +02:00
|
|
|
#ifndef LOG_CONS /* Kludge: mips-dec-ultrix4.5 has no LOG_CONS/LOG_LOCAL5 */
|
|
|
|
#define LOG_CONS 0
|
|
|
|
#endif
|
|
|
|
#ifndef LOG_LOCAL5
|
|
|
|
#define LOG_LOCAL5 0
|
|
|
|
#endif
|
2002-02-19 21:07:13 +01:00
|
|
|
/* Syslog initialisieren */
|
2003-03-31 17:54:21 +02:00
|
|
|
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
|
2001-12-27 02:44:49 +01:00
|
|
|
#endif
|
2002-02-19 21:07:13 +01:00
|
|
|
|
|
|
|
/* Hello World! */
|
2005-02-09 10:52:58 +01:00
|
|
|
Log( LOG_NOTICE, "%s started.", NGIRCd_Version );
|
2002-03-06 16:36:04 +01:00
|
|
|
|
2002-02-19 21:07:13 +01:00
|
|
|
/* Informationen uebern den "Operation Mode" */
|
2005-01-20 01:11:49 +01:00
|
|
|
Init_Txt[0] = '\0';
|
2002-02-19 21:07:13 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
if( NGIRCd_Debug )
|
|
|
|
{
|
2005-06-17 21:16:53 +02:00
|
|
|
strlcpy( Init_Txt, "debug-mode", sizeof Init_Txt );
|
2002-02-19 21:07:13 +01:00
|
|
|
}
|
|
|
|
#endif
|
2005-06-24 21:20:56 +02:00
|
|
|
if( ! Is_Daemon )
|
2002-02-19 21:07:13 +01:00
|
|
|
{
|
2005-06-17 21:16:53 +02:00
|
|
|
if( Init_Txt[0] ) strlcat( Init_Txt, ", ", sizeof Init_Txt );
|
|
|
|
strlcat( Init_Txt, "no-daemon-mode", sizeof Init_Txt );
|
2002-02-19 21:07:13 +01:00
|
|
|
}
|
|
|
|
if( NGIRCd_Passive )
|
|
|
|
{
|
2005-06-17 21:16:53 +02:00
|
|
|
if( Init_Txt[0] ) strlcat( Init_Txt, ", ", sizeof Init_Txt );
|
|
|
|
strlcat( Init_Txt, "passive-mode", sizeof Init_Txt );
|
2002-02-19 21:07:13 +01:00
|
|
|
}
|
|
|
|
#ifdef SNIFFER
|
|
|
|
if( NGIRCd_Sniffer )
|
|
|
|
{
|
2005-06-17 21:16:53 +02:00
|
|
|
if( Init_Txt[0] ) strlcat( Init_Txt, ", ", sizeof Init_Txt );
|
|
|
|
strlcat( Init_Txt, "network sniffer", sizeof Init_Txt );
|
2002-02-19 21:07:13 +01:00
|
|
|
}
|
|
|
|
#endif
|
2002-03-30 00:33:42 +01:00
|
|
|
if( Init_Txt[0] ) Log( LOG_INFO, "Activating: %s.", Init_Txt );
|
2004-05-07 13:19:20 +02:00
|
|
|
|
2005-02-10 13:49:04 +01:00
|
|
|
#ifdef DEBUG
|
2004-05-07 13:19:20 +02:00
|
|
|
Error_File[0] = '\0';
|
2005-02-10 13:49:04 +01:00
|
|
|
#endif
|
2002-03-30 00:33:42 +01:00
|
|
|
} /* Log_Init */
|
2002-03-06 16:36:04 +01:00
|
|
|
|
2002-03-30 00:33:42 +01:00
|
|
|
|
2005-02-10 13:49:04 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
|
|
|
Log_InitErrorfile( void )
|
2002-03-30 00:33:42 +01:00
|
|
|
{
|
2002-03-29 23:55:42 +01:00
|
|
|
/* "Error-Log" initialisieren: stderr in Datei umlenken. Dort
|
|
|
|
* landen z.B. alle Ausgaben von assert()-Aufrufen. */
|
2002-03-30 00:33:42 +01:00
|
|
|
|
2002-03-31 18:46:15 +02:00
|
|
|
/* Dateiname zusammen bauen */
|
2005-06-17 21:16:53 +02:00
|
|
|
snprintf( Error_File, sizeof Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE_NAME, (long)getpid( ));
|
2002-03-31 18:46:15 +02:00
|
|
|
|
|
|
|
/* stderr umlenken */
|
|
|
|
fflush( stderr );
|
2002-03-29 23:55:42 +01:00
|
|
|
if( ! freopen( Error_File, "w", stderr ))
|
|
|
|
{
|
|
|
|
Log( LOG_ERR, "Can't reopen stderr (\"%s\"): %s", Error_File, strerror( errno ));
|
|
|
|
return;
|
|
|
|
}
|
2002-03-06 16:36:04 +01:00
|
|
|
|
2002-03-31 18:46:15 +02:00
|
|
|
/* Einige Infos in das Error-File schreiben */
|
2002-03-30 00:58:10 +01:00
|
|
|
fputs( ctime( &NGIRCd_Start ), stderr );
|
2005-02-09 10:52:58 +01:00
|
|
|
fprintf( stderr, "%s started.\n", NGIRCd_Version );
|
2002-03-30 00:33:42 +01:00
|
|
|
fprintf( stderr, "Activating: %s\n\n", Init_Txt[0] ? Init_Txt : "-" );
|
2002-03-06 16:36:04 +01:00
|
|
|
fflush( stderr );
|
2002-03-31 18:46:15 +02:00
|
|
|
|
2005-06-24 21:20:56 +02:00
|
|
|
#ifdef DEBUG
|
2002-03-31 18:46:15 +02:00
|
|
|
Log( LOG_DEBUG, "Redirected stderr to \"%s\".", Error_File );
|
2005-06-24 21:20:56 +02:00
|
|
|
#endif
|
2002-03-30 00:33:42 +01:00
|
|
|
} /* Log_InitErrfile */
|
2001-12-11 22:53:04 +01:00
|
|
|
|
2005-02-10 13:49:04 +01:00
|
|
|
#endif
|
|
|
|
|
2001-12-11 22:53:04 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
|
|
|
Log_Exit( void )
|
2001-12-11 22:53:04 +01:00
|
|
|
{
|
2002-02-19 21:07:13 +01:00
|
|
|
/* Good Bye! */
|
2003-03-31 17:54:21 +02:00
|
|
|
if( NGIRCd_SignalRestart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE_NAME );
|
|
|
|
else Log( LOG_NOTICE, "%s done.", PACKAGE_NAME );
|
2002-03-21 13:00:23 +01:00
|
|
|
|
2005-02-10 13:49:04 +01:00
|
|
|
#ifdef DEBUG
|
2004-05-07 13:19:20 +02:00
|
|
|
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 ));
|
|
|
|
}
|
2005-02-10 13:49:04 +01:00
|
|
|
#endif
|
2002-03-29 21:59:22 +01:00
|
|
|
|
2003-12-26 16:55:07 +01:00
|
|
|
#ifdef SYSLOG
|
2002-02-19 21:07:13 +01:00
|
|
|
/* syslog abmelden */
|
2001-12-13 00:31:24 +01:00
|
|
|
closelog( );
|
2001-12-27 02:44:49 +01:00
|
|
|
#endif
|
2001-12-11 22:53:04 +01:00
|
|
|
} /* Log_Exit */
|
|
|
|
|
|
|
|
|
2006-07-24 01:23:45 +02:00
|
|
|
/**
|
|
|
|
* Log function for debug messages.
|
|
|
|
* This function is only functional when the program is compiled with debug
|
|
|
|
* code enabled; otherwise it is an empty function which the compiler will
|
|
|
|
* hopefully mangle down to "nothing". Therefore you should use LogDebug(...)
|
|
|
|
* in favor to Log(LOG_DEBUG, ...).
|
|
|
|
* @param Format Format string like printf().
|
|
|
|
* @param ... Further arguments.
|
|
|
|
*/
|
2006-02-08 18:33:28 +01:00
|
|
|
# ifdef PROTOTYPES
|
|
|
|
GLOBAL void
|
2006-07-24 01:23:45 +02:00
|
|
|
#ifdef DEBUG
|
2006-02-08 18:33:28 +01:00
|
|
|
LogDebug( const char *Format, ... )
|
2006-07-24 01:23:45 +02:00
|
|
|
#else
|
|
|
|
LogDebug( UNUSED const char *Format, ... )
|
|
|
|
#endif /* DEBUG */
|
2006-02-08 18:33:28 +01:00
|
|
|
# else
|
|
|
|
GLOBAL void
|
|
|
|
LogDebug( Format, va_alist )
|
|
|
|
const char *Format;
|
|
|
|
va_dcl
|
2006-07-24 01:23:45 +02:00
|
|
|
# endif /* PROTOTYPES */
|
2006-02-08 18:33:28 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
|
|
|
char msg[MAX_LOG_MSG_LEN];
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
if (!NGIRCd_Debug) return;
|
|
|
|
#ifdef PROTOTYPES
|
|
|
|
va_start( ap, Format );
|
|
|
|
#else
|
|
|
|
va_start( ap );
|
|
|
|
#endif
|
|
|
|
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
|
|
|
|
va_end( ap );
|
|
|
|
Log(LOG_DEBUG, "%s", msg);
|
|
|
|
}
|
|
|
|
#else
|
2006-07-24 01:23:45 +02:00
|
|
|
{
|
|
|
|
/* Do nothing.
|
|
|
|
* The compiler should optimize this out, please ;-) */
|
|
|
|
}
|
2006-02-08 18:33:28 +01:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
|
2006-07-24 01:23:45 +02:00
|
|
|
/**
|
|
|
|
* Logging function of ngIRCd.
|
|
|
|
* This function logs messages to the console and/or syslog, whichever is
|
|
|
|
* suitable for the mode ngIRCd is running in (daemon vs. non-daemon).
|
|
|
|
* Please note: you sould use LogDebug(...) for debug messages!
|
|
|
|
* @param Level syslog level (LOG_xxx)
|
|
|
|
* @param Format Format string like printf().
|
|
|
|
* @param ... Further arguments.
|
|
|
|
*/
|
2002-05-30 18:52:20 +02:00
|
|
|
#ifdef PROTOTYPES
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
|
|
|
Log( int Level, const char *Format, ... )
|
2002-05-30 18:52:20 +02:00
|
|
|
#else
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
2002-05-30 18:52:20 +02:00
|
|
|
Log( Level, Format, va_alist )
|
2005-03-19 19:43:48 +01:00
|
|
|
int Level;
|
|
|
|
const char *Format;
|
2002-05-30 18:52:20 +02:00
|
|
|
va_dcl
|
|
|
|
#endif
|
2001-12-11 22:53:04 +01:00
|
|
|
{
|
|
|
|
/* Eintrag in Logfile(s) schreiben */
|
2005-03-19 19:43:48 +01:00
|
|
|
char msg[MAX_LOG_MSG_LEN];
|
|
|
|
bool snotice;
|
2001-12-11 22:53:04 +01:00
|
|
|
va_list ap;
|
|
|
|
|
2001-12-29 21:16:31 +01:00
|
|
|
assert( Format != NULL );
|
|
|
|
|
2002-03-27 21:53:30 +01:00
|
|
|
if( Level & LOG_snotice )
|
|
|
|
{
|
|
|
|
/* Notice an User mit "s" Mode */
|
2005-03-19 19:43:48 +01:00
|
|
|
snotice = true;
|
2002-03-27 21:53:30 +01:00
|
|
|
Level &= ~LOG_snotice;
|
|
|
|
}
|
2005-03-19 19:43:48 +01:00
|
|
|
else snotice = false;
|
2002-03-27 21:53:30 +01:00
|
|
|
|
2002-01-11 15:45:37 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
|
|
|
|
#else
|
2001-12-25 23:04:26 +01:00
|
|
|
if( Level == LOG_DEBUG ) return;
|
|
|
|
#endif
|
|
|
|
|
2001-12-11 22:53:04 +01:00
|
|
|
/* String mit variablen Argumenten zusammenbauen ... */
|
2002-05-30 18:52:20 +02:00
|
|
|
#ifdef PROTOTYPES
|
2001-12-11 22:53:04 +01:00
|
|
|
va_start( ap, Format );
|
2002-05-30 18:52:20 +02:00
|
|
|
#else
|
|
|
|
va_start( ap );
|
|
|
|
#endif
|
2002-03-03 18:17:01 +01:00
|
|
|
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
|
|
|
|
va_end( ap );
|
2001-12-11 22:53:04 +01:00
|
|
|
|
2005-06-24 21:20:56 +02:00
|
|
|
if( ! Is_Daemon )
|
2002-03-30 14:37:12 +01:00
|
|
|
{
|
|
|
|
/* auf Konsole ausgeben */
|
2005-03-19 19:43:48 +01:00
|
|
|
fprintf( stdout, "[%d:%d] %s\n", (int)getpid( ), Level, msg );
|
2002-09-03 19:25:45 +02:00
|
|
|
fflush( stdout );
|
2002-03-30 14:37:12 +01:00
|
|
|
}
|
2003-12-26 16:55:07 +01:00
|
|
|
#ifdef SYSLOG
|
2002-09-10 00:55:21 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Syslog */
|
2002-10-04 13:21:46 +02:00
|
|
|
syslog( Level, "%s", msg );
|
2002-09-10 00:55:21 +02:00
|
|
|
}
|
|
|
|
#endif
|
2002-03-30 14:37:12 +01:00
|
|
|
|
|
|
|
if( Level <= LOG_CRIT )
|
|
|
|
{
|
2005-02-10 13:49:04 +01:00
|
|
|
/* log critical messages to stderr */
|
2002-03-30 14:37:12 +01:00
|
|
|
fprintf( stderr, "%s\n", msg );
|
|
|
|
fflush( stderr );
|
|
|
|
}
|
2002-03-06 16:36:04 +01:00
|
|
|
|
2002-03-30 14:37:12 +01:00
|
|
|
if( snotice )
|
|
|
|
{
|
|
|
|
/* NOTICE an lokale User mit "s"-Mode */
|
|
|
|
Wall_ServerNotice( msg );
|
|
|
|
}
|
2001-12-11 22:53:04 +01:00
|
|
|
} /* Log */
|
|
|
|
|
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
|
|
|
Log_Init_Resolver( void )
|
2001-12-29 21:16:31 +01:00
|
|
|
{
|
2003-12-26 16:55:07 +01:00
|
|
|
#ifdef SYSLOG
|
2003-03-31 17:54:21 +02:00
|
|
|
openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
|
2001-12-29 21:16:31 +01:00
|
|
|
#endif
|
2005-06-24 21:20:56 +02:00
|
|
|
#ifdef DEBUG
|
2004-05-11 01:57:46 +02:00
|
|
|
Log_Resolver( LOG_DEBUG, "Resolver sub-process starting, PID %d.", getpid( ));
|
2005-06-24 21:20:56 +02:00
|
|
|
#endif
|
2001-12-29 21:16:31 +01:00
|
|
|
} /* Log_Init_Resolver */
|
|
|
|
|
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
|
|
|
Log_Exit_Resolver( void )
|
2001-12-29 21:16:31 +01:00
|
|
|
{
|
2005-06-24 21:20:56 +02:00
|
|
|
#ifdef DEBUG
|
2004-05-11 01:57:46 +02:00
|
|
|
Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( ));
|
2005-06-24 21:20:56 +02:00
|
|
|
#endif
|
2003-12-26 16:55:07 +01:00
|
|
|
#ifdef SYSLOG
|
2001-12-29 21:16:31 +01:00
|
|
|
closelog( );
|
|
|
|
#endif
|
|
|
|
} /* Log_Exit_Resolver */
|
|
|
|
|
|
|
|
|
2002-05-30 18:52:20 +02:00
|
|
|
#ifdef PROTOTYPES
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
|
|
|
Log_Resolver( const int Level, const char *Format, ... )
|
2002-05-30 18:52:20 +02:00
|
|
|
#else
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void
|
2002-05-30 18:52:20 +02:00
|
|
|
Log_Resolver( Level, Format, va_alist )
|
2005-03-19 19:43:48 +01:00
|
|
|
const int Level;
|
|
|
|
const char *Format;
|
2002-05-30 18:52:20 +02:00
|
|
|
va_dcl
|
|
|
|
#endif
|
2001-12-29 21:16:31 +01:00
|
|
|
{
|
|
|
|
/* Eintrag des Resolver in Logfile(s) schreiben */
|
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
char msg[MAX_LOG_MSG_LEN];
|
2001-12-29 21:16:31 +01:00
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
assert( Format != NULL );
|
|
|
|
|
2002-01-11 15:45:37 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
|
|
|
|
#else
|
2001-12-29 21:16:31 +01:00
|
|
|
if( Level == LOG_DEBUG ) return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* String mit variablen Argumenten zusammenbauen ... */
|
2002-05-30 18:52:20 +02:00
|
|
|
#ifdef PROTOTYPES
|
2001-12-29 21:16:31 +01:00
|
|
|
va_start( ap, Format );
|
2002-05-30 18:52:20 +02:00
|
|
|
#else
|
|
|
|
va_start( ap );
|
|
|
|
#endif
|
2002-03-03 18:17:01 +01:00
|
|
|
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
|
|
|
|
va_end( ap );
|
2001-12-29 21:16:31 +01:00
|
|
|
|
2005-06-24 21:20:56 +02:00
|
|
|
if( ! Is_Daemon )
|
2004-05-11 01:57:46 +02:00
|
|
|
{
|
|
|
|
/* Output to console */
|
2005-03-19 19:43:48 +01:00
|
|
|
fprintf( stdout, "[%d:%d] %s\n", (int)getpid( ), Level, msg );
|
2004-05-11 01:57:46 +02:00
|
|
|
fflush( stdout );
|
|
|
|
}
|
|
|
|
#ifdef SYSLOG
|
2005-02-03 10:26:42 +01:00
|
|
|
else syslog( Level, "%s", msg );
|
2002-01-05 16:54:40 +01:00
|
|
|
#endif
|
2001-12-29 21:16:31 +01:00
|
|
|
} /* Log_Resolver */
|
|
|
|
|
|
|
|
|
2005-08-29 12:58:00 +02:00
|
|
|
/**
|
|
|
|
* Send log messages to users flagged with the "s" mode.
|
|
|
|
* @param Msg The message to send.
|
|
|
|
*/
|
2005-07-31 22:13:07 +02:00
|
|
|
static void
|
2005-03-19 19:43:48 +01:00
|
|
|
Wall_ServerNotice( char *Msg )
|
2002-03-27 21:53:30 +01:00
|
|
|
{
|
|
|
|
CLIENT *c;
|
|
|
|
|
|
|
|
assert( Msg != NULL );
|
2002-03-29 23:55:42 +01:00
|
|
|
|
2002-03-27 21:53:30 +01:00
|
|
|
c = Client_First( );
|
2005-08-29 12:58:00 +02:00
|
|
|
while(c) {
|
|
|
|
if (Client_Conn(c) > NONE && Client_HasMode(c, 's'))
|
|
|
|
IRC_WriteStrClient(c, "NOTICE %s :%s%s", Client_ID(c),
|
|
|
|
NOTICE_TXTPREFIX, Msg);
|
|
|
|
|
2002-03-27 21:53:30 +01:00
|
|
|
c = Client_Next( c );
|
|
|
|
}
|
|
|
|
} /* Wall_ServerNotice */
|
|
|
|
|
|
|
|
|
2001-12-11 22:53:04 +01:00
|
|
|
/* -eof- */
|