From 81f951b7cf4f80013c3e0523055c06c68667aa2a Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Tue, 4 Jun 2002 01:10:01 +0000 Subject: [PATCH] added init_logging() to initial Spong::Log module --- src/spong-status.pl | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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, + ); + +} + + -- 2.30.2