diff options
| author | fukachan <fukachan> | 2001-01-27 04:01:59 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-01-27 04:01:59 +0000 |
| commit | 3c7b2cbe15b12943a1e894360a12a1922bfd292e (patch) | |
| tree | 34e7beed31d5f70734432c20fc7195cb6e7e8651 | |
| parent | 973e7c66a0262dfab1e394d03548f0aa1b37358e (diff) | |
| download | fml8-3c7b2cbe15b12943a1e894360a12a1922bfd292e.tar.gz fml8-3c7b2cbe15b12943a1e894360a12a1922bfd292e.tar.bz2 fml8-3c7b2cbe15b12943a1e894360a12a1922bfd292e.zip | |
add sender information in each log message
which is compatible with fml 4.0
| -rw-r--r-- | fml/lib/FML/Log.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fml/lib/FML/Log.pm b/fml/lib/FML/Log.pm index 8da3c616..98d238a8 100644 --- a/fml/lib/FML/Log.pm +++ b/fml/lib/FML/Log.pm @@ -17,7 +17,7 @@ use strict; use Carp; use FML::Config; use FML::Date; - +use FML::Credential; # usage: &Log( message, { log_file => $log_file } ); # return: none @@ -42,11 +42,14 @@ sub Log use FileHandle; # When the second argument is not defined, use the default log_file. - my $file = $log_file || $config->{ log_file } || '/dev/stderr'; - my $fh = new FileHandle ">> $file"; + my $file = $log_file || $config->{ log_file } || '/dev/stderr'; + my $fh = new FileHandle ">> $file"; + my $sender = FML::Credential->sender; if (defined $fh) { - print $fh $rdate->{'log_file_style'}, " ", $mesg, "\n"; + print $fh $rdate->{'log_file_style'}, " ", $mesg; + print $fh " ($sender)" if defined $sender; + print $fh "\n"; } else { croak "Error: cannot open $file\n"; |
