summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Log.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-03-20 06:12:53 +0000
committerfukachan <fukachan>2001-03-20 06:12:53 +0000
commitf35e1ae982ebd8b889b33b49e0bb0af100d3a2f9 (patch)
treefe9958f203c0368fdcbb45dd4fe420b79a8ee329 /fml/lib/FML/Log.pm
parent5e58cb08c28e76631552f2af115f53c1c8ffcde6 (diff)
downloadfml8-f35e1ae982ebd8b889b33b49e0bb0af100d3a2f9.tar.gz
fml8-f35e1ae982ebd8b889b33b49e0bb0af100d3a2f9.tar.bz2
fml8-f35e1ae982ebd8b889b33b49e0bb0af100d3a2f9.zip
define Log(), LogWarn() and LogError().
$args accpets $priority.
Diffstat (limited to 'fml/lib/FML/Log.pm')
-rw-r--r--fml/lib/FML/Log.pm39
1 files changed, 30 insertions, 9 deletions
diff --git a/fml/lib/FML/Log.pm b/fml/lib/FML/Log.pm
index 0a33ab50..9e516f3b 100644
--- a/fml/lib/FML/Log.pm
+++ b/fml/lib/FML/Log.pm
@@ -7,11 +7,10 @@
#
package FML::Log;
-require Exporter;
+require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(Log);
-@EXPORT_OK = qw(Log);
+@EXPORT_OK = qw(Log LogWarn LogError);
use strict;
use Carp;
@@ -27,14 +26,15 @@ FML::Log - several interfaces to open several files
To import Log(),
- use FML::Log qw(Log);
+ use FML::Log qw(Log LogWarn LogError);
&Log( $log_message );
or specify arguments in the hash reference
- use FML::Log qw(Log);
+ use FML::Log qw(Log LogWarn LogError);
&Log( $log_message , {
log_file => $log_file,
+ priority => $priority,
facility => $facility,
level => $level,
});
@@ -52,6 +52,7 @@ You can specify C<log_file>, C<facility> and C<level> as an optional.
$args = {
log_file => $log_file,
+ priority => $priority,
facility => $facility,
level => $level,
};
@@ -60,12 +61,17 @@ This routine depends on C<FML::Config> and C<FML::Credential>.
$config->{ log_format_type } defines the format sytle.
C<sender> to log is taken from C<FML::Credential> object.
+=head2 LogWarn( $message [, $args])
+
+same as Log("warn: $message", $args);
+
+=head2 LogError( $message [, $args])
+
+same as Log("error: $message", $args);
+
=cut
-# usage: &Log( message, { log_file => $log_file } );
-# return: none
-#
sub Log
{
my ($mesg, $args) = @_;
@@ -73,6 +79,7 @@ sub Log
# parse arguments
my $log_file = $args->{ log_file };
+ my $priority = $args->{ priority };
my $facility = $args->{ facility };
my $level = $args->{ level };
@@ -105,11 +112,25 @@ sub Log
}
}
else {
- croak "Error: cannot open $file\n";
+ croak("cannot open $file");
}
}
+sub LogWarn
+{
+ my ($mesg, $args) = @_;
+ Log("warn: ".$mesg, $args);
+}
+
+
+sub LogError
+{
+ my ($mesg, $args) = @_;
+ Log("error: ".$mesg, $args);
+}
+
+
=head1 SEE ALSO
L<FML::Date>,