summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Log.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-12-23 11:37:06 +0000
committerfukachan <fukachan>2001-12-23 11:37:06 +0000
commitbb29e37d27b05933c4fc6705954d84ed7f603286 (patch)
tree77e0838f1cc1947da304807d36ddbd057f045235 /fml/lib/FML/Log.pm
parent04cb8de0162bf2d3acc6ce19226b5e93c8e05cc1 (diff)
downloadfml8-bb29e37d27b05933c4fc6705954d84ed7f603286.tar.gz
fml8-bb29e37d27b05933c4fc6705954d84ed7f603286.tar.bz2
fml8-bb29e37d27b05933c4fc6705954d84ed7f603286.zip
update documents, comments
Diffstat (limited to 'fml/lib/FML/Log.pm')
-rw-r--r--fml/lib/FML/Log.pm42
1 files changed, 31 insertions, 11 deletions
diff --git a/fml/lib/FML/Log.pm b/fml/lib/FML/Log.pm
index 7e6127eb..6450f5f8 100644
--- a/fml/lib/FML/Log.pm
+++ b/fml/lib/FML/Log.pm
@@ -2,7 +2,7 @@
#
# Copyright (C) 2000 Ken'ichi Fukamachi
#
-# $FML: Log.pm,v 1.13 2001/11/27 15:19:39 fukachan Exp $
+# $FML: Log.pm,v 1.14 2001/12/22 09:21:01 fukachan Exp $
#
package FML::Log;
@@ -13,7 +13,6 @@ require Exporter;
use strict;
use Carp;
-use Mail::Message::Date;
use FML::Config;
use FML::Credential;
@@ -73,22 +72,35 @@ same as Log("error: $message", $args);
=cut
+# Descriptions: write message $msg to logfile
+# Arguments: STR($msg) HASH_REF($args)
+# Side Effects: update logfile
+# Return Value: none
sub Log
{
my ($mesg, $args) = @_;
- my $config = new FML::Config;
+ my $config = new FML::Config;
+ my $log_file = '';
+ my $priority = '';
+ my $facility = '';
+ my $level = '';
+ my $rdate = '';
- # parse arguments
- my $log_file = $args->{ log_file };
- my $priority = $args->{ priority };
- my $facility = $args->{ facility };
- my $level = $args->{ level };
+ # simple check: null $mesg string is invalid.
+ return undef unless defined $mesg;
+ return undef unless $mesg;
- # invalid calling
- $mesg || return undef ;
+ # parse arguments
+ $log_file = $args->{ log_file } if defined $args->{ log_file };
+ $priority = $args->{ priority } if defined $args->{ priority };
+ $facility = $args->{ facility } if defined $args->{ facility };
+ $level = $args->{ level } if defined $args->{ level };
# reference to "date" object
- my $rdate = new Mail::Message::Date;
+ eval q{
+ use Mail::Message::Date;
+ $rdate = new Mail::Message::Date;
+ };
# open the $file by using FileHandle.pm
use FileHandle;
@@ -118,6 +130,10 @@ sub Log
}
+# Descriptions: write message "warn: $msg", call Log() ASAP
+# Arguments: STR($msg) HASH_REF($args)
+# Side Effects: none
+# Return Value: none
sub LogWarn
{
my ($mesg, $args) = @_;
@@ -125,6 +141,10 @@ sub LogWarn
}
+# Descriptions: write message "error: $msg", call Log() ASAP
+# Arguments: STR($msg) HASH_REF($args)
+# Side Effects: none
+# Return Value: none
sub LogError
{
my ($mesg, $args) = @_;