From: Stephen L Johnson Date: Tue, 4 Jun 2002 01:10:01 +0000 (+0000) Subject: added init_logging() to initial Spong::Log module X-Git-Tag: spong-2_7_7~2 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81f951b7cf4f80013c3e0523055c06c68667aa2a;p=spong.git added init_logging() to initial Spong::Log module --- diff --git a/src/spong-status.pl b/src/spong-status.pl index 145cbab..8774fd5 100755 --- a/src/spong-status.pl +++ b/src/spong-status.pl @@ -3,7 +3,7 @@ # This program can be used to send Status update messages to the Spong Server # from shell scripts or other external programs. # -# $Id: spong-status.pl,v 1.8 2001/09/28 21:21:35 sljohnson Exp $ +# $Id: spong-status.pl,v 1.9 2002/06/04 01:10:01 sljohnson Exp $ use POSIX; use Getopt::Long; @@ -145,3 +145,26 @@ sub load_config_files { sub error { print STDERR scalar localtime,": $_\n"; } +# This function initializes the debug and error logging contexts in the +# Log module. + +sub init_logging { + if (defined $debuglevel) { + $debug = ($debuglevel == 0) ? 1 : $debuglevel + } + + Spong::Log::set_debug_context( 'debuglevel' => $debug ); + + my $filename = ($SPONG_LOG_FILE) ? "$SPONGTMP/spong-server.log" : ""; + my $syslog = ($SPONG_LOG_SYSLOG) ? 1 : 0; + + Spong::Log::set_error_context( syslog => $syslog, + ident => 'spong-server', + logopt => 'pid,cons', + priority => 'ERR', + filename => $filename, + ); + +} + +