]> git.etc.gen.nz Git - spong.git/commitdiff
added init_logging() to initial Spong::Log module
authorStephen L Johnson <sjohnson@monsters.org>
Tue, 4 Jun 2002 01:10:01 +0000 (01:10 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Tue, 4 Jun 2002 01:10:01 +0000 (01:10 +0000)
src/spong-status.pl

index 145cbabf7f671c041b1496c85dcf089c3d4a22b3..8774fd530be363741ebc58d8fa2acda3afb5d5cc 100755 (executable)
@@ -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,
+                                 );
+
+}
+
+