diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-14 01:55:30 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-14 01:55:30 +0200 |
commit | 156bbd7b66cf29220c2ff6a86217c4dec5e33765 (patch) | |
tree | 692e9cb7d2edf6c3ddfd0b9aa85a4f6b5d4c4a12 | |
parent | c0417e80a965d74944260752f4f58378a4cdd8fd (diff) |
Log to stderr+syslog until daemonized. Current behaviour is too confusing
and annoying.
-rw-r--r-- | bitlbee.c | 10 | ||||
-rw-r--r-- | log.c | 2 | ||||
-rw-r--r-- | unix.c | 13 |
3 files changed, 18 insertions, 7 deletions
@@ -41,8 +41,8 @@ int bitlbee_daemon_init() int i; FILE *fp; - log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); - log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); + log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); memset( &hints, 0, sizeof( hints ) ); hints.ai_family = PF_UNSPEC; @@ -145,6 +145,12 @@ int bitlbee_daemon_init() } #endif + if( !global.conf->nofork ) + { + log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); + log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); + } + return( 0 ); } @@ -171,5 +171,7 @@ static void log_console(int level, char *message) { if(level == LOGLVL_DEBUG) fprintf(stdout, "Debug: %s\n", message); #endif + /* Always log stuff in syslogs too. */ + log_syslog(level, message); return; } @@ -72,19 +72,22 @@ int main( int argc, char *argv[] ) log_link( LOGLVL_WARNING, LOGOUTPUT_IRC ); i = bitlbee_inetd_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); + log_message( LOGLVL_INFO, "BitlBee %s starting in inetd mode.", BITLBEE_VERSION ); } else if( global.conf->runmode == RUNMODE_DAEMON ) { - log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); - log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); + log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); i = bitlbee_daemon_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); + log_message( LOGLVL_INFO, "BitlBee %s starting in daemon mode.", BITLBEE_VERSION ); } else if( global.conf->runmode == RUNMODE_FORKDAEMON ) { + log_link( LOGLVL_ERROR, LOGOUTPUT_CONSOLE ); + log_link( LOGLVL_WARNING, LOGOUTPUT_CONSOLE ); + /* In case the operator requests a restart, we need this. */ old_cwd = g_malloc( 256 ); if( getcwd( old_cwd, 255 ) == NULL ) @@ -95,7 +98,7 @@ int main( int argc, char *argv[] ) } i = bitlbee_daemon_init(); - log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION ); + log_message( LOGLVL_INFO, "BitlBee %s starting in forking daemon mode.", BITLBEE_VERSION ); } if( i != 0 ) return( i ); |