diff options
| author | fukachan <fukachan> | 2003-08-23 07:24:40 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-08-23 07:24:40 +0000 |
| commit | 9723a7a408f11cf8beaf8f618d2863c2f3e28ddb (patch) | |
| tree | dd4b1e0ae8d32873a0a289d5ba2a7cf01a2cc3ad /fml | |
| parent | 1757df2907216e1ab833c05ac8a2757f0b6a67e7 (diff) | |
| download | fml8-9723a7a408f11cf8beaf8f618d2863c2f3e28ddb.tar.gz fml8-9723a7a408f11cf8beaf8f618d2863c2f3e28ddb.tar.bz2 fml8-9723a7a408f11cf8beaf8f618d2863c2f3e28ddb.zip | |
define $curproc->log, logwarn, logerror and log_message() methods.
modified to use $curproc->log*() interface.
Diffstat (limited to 'fml')
39 files changed, 443 insertions, 351 deletions
diff --git a/fml/lib/FML/Article/Sequence.pm b/fml/lib/FML/Article/Sequence.pm index 41a2c14d..aa2e65ca 100644 --- a/fml/lib/FML/Article/Sequence.pm +++ b/fml/lib/FML/Article/Sequence.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Sequence.pm,v 1.2 2003/03/16 12:52:43 fukachan Exp $ +# $FML: Sequence.pm,v 1.3 2003/08/23 04:35:28 fukachan Exp $ # package FML::Article::Sequence; @@ -128,7 +128,7 @@ sub speculate_max_id $spool_dir = $config->{ spool_dir }; } - Log("max_id: (debug) scan $spool_dir subdir=$use_subdir"); + $curproc->log("max_id: (debug) scan $spool_dir subdir=$use_subdir"); if ($use_subdir) { use DirHandle; @@ -155,7 +155,7 @@ sub speculate_max_id # XXX-TODO wrong? to speculate max_id in subdir spool? $subdir = File::Spec->catfile($spool_dir, $max_subdir); - Log("max_id: (debug) scan $subdir"); + $curproc->log("max_id: (debug) scan $subdir"); $curproc->speculate_max_id($subdir); } } diff --git a/fml/lib/FML/Command.pm b/fml/lib/FML/Command.pm index 76364bb2..bf136c68 100644 --- a/fml/lib/FML/Command.pm +++ b/fml/lib/FML/Command.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Command.pm,v 1.39 2003/06/29 05:48:11 fukachan Exp $ +# $FML: Command.pm,v 1.40 2003/08/23 04:35:26 fukachan Exp $ # # XXX @@ -102,13 +102,13 @@ sub rewrite_prompt $command->rewrite_prompt($curproc, $command_args, $rbuf); } else { - LogError("call $pkg but rewrite_prompt() not supported") if $debug; + $curproc->logerror("call $pkg but rewrite_prompt() not supported") if $debug; } } else { if ($debug) { - LogError($@); - LogError("cannot load $pkg"); + $curproc->logerror($@); + $curproc->logerror("cannot load $pkg"); } } } @@ -180,7 +180,7 @@ sub AUTOLOAD $comname =~ s/.*:://; my $pkg = "FML::Command::${mode}::${comname}"; - Log("load $pkg") if $myname eq 'loader'; # debug + $curproc->log("load $pkg") if $myname eq 'loader'; # debug my $command = undef; eval qq{ use $pkg; \$command = new $pkg;}; @@ -208,7 +208,7 @@ sub AUTOLOAD } } else { - LogError("${pkg} has no need_lock method"); + $curproc->logerror("${pkg} has no need_lock method"); $curproc->reply_message("Error: invalid command definition\n"); $curproc->reply_message(" need_lock() is undefined\n"); $curproc->reply_message(" Please contact the maintainer\n"); @@ -225,12 +225,12 @@ sub AUTOLOAD $curproc->unlock($lock_channel) if $need_lock; } else { - LogError("${pkg} has no process method"); + $curproc->logerror("${pkg} has no process method"); } } else { - LogError($@) if $@; - LogError("$pkg module is not found"); + $curproc->logerror($@) if $@; + $curproc->logerror("$pkg module is not found"); croak("$pkg module is not found"); # upcall to FML::Process::Command } } diff --git a/fml/lib/FML/Command/Admin/chaddr.pm b/fml/lib/FML/Command/Admin/chaddr.pm index c047c4cc..50306b64 100644 --- a/fml/lib/FML/Command/Admin/chaddr.pm +++ b/fml/lib/FML/Command/Admin/chaddr.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: chaddr.pm,v 1.16 2003/05/12 10:16:42 fukachan Exp $ +# $FML: chaddr.pm,v 1.17 2003/08/23 04:35:30 fukachan Exp $ # package FML::Command::Admin::chaddr; @@ -85,7 +85,7 @@ sub process $new_address = $options->[ 1 ]; } - Log("chaddr: $old_address -> $new_address"); + $curproc->log("chaddr: $old_address -> $new_address"); # sanity check unless ($old_address && $new_address) { diff --git a/fml/lib/FML/Command/Admin/changepassword.pm b/fml/lib/FML/Command/Admin/changepassword.pm index 0dd5793b..bc778b9a 100644 --- a/fml/lib/FML/Command/Admin/changepassword.pm +++ b/fml/lib/FML/Command/Admin/changepassword.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: changepassword.pm,v 1.5 2003/05/12 10:16:42 fukachan Exp $ +# $FML: changepassword.pm,v 1.6 2003/08/23 04:35:30 fukachan Exp $ # package FML::Command::Admin::changepassword; @@ -105,7 +105,7 @@ sub process $self->_change_password($curproc, $command_args, $address, $password); } else { - LogError("myname=$myname unknown program"); + $curproc->logerror("myname=$myname unknown program"); } } diff --git a/fml/lib/FML/Command/Admin/get.pm b/fml/lib/FML/Command/Admin/get.pm index 59ac655e..7d447040 100644 --- a/fml/lib/FML/Command/Admin/get.pm +++ b/fml/lib/FML/Command/Admin/get.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: get.pm,v 1.18 2003/03/18 10:35:13 fukachan Exp $ +# $FML: get.pm,v 1.19 2003/03/18 10:52:35 fukachan Exp $ # package FML::Command::Admin::get; @@ -78,7 +78,7 @@ sub process # XXX-TODO: we expect send_file() validates ${filename,filepath}. if (-f $filepath) { - Log("send back $filename"); + $curproc->log("send back $filename"); $command_args->{ _filename_to_send } = $filename; $command_args->{ _filepath_to_send } = $filepath; @@ -89,7 +89,7 @@ sub process delete $command_args->{ _filepath_to_send }; } else { - Log("$filename not found"); + $curproc->log("$filename not found"); $curproc->reply_message_nl('error.no_such_file', "no such file $filename", { diff --git a/fml/lib/FML/Command/Admin/list.pm b/fml/lib/FML/Command/Admin/list.pm index 33391222..1f22e838 100644 --- a/fml/lib/FML/Command/Admin/list.pm +++ b/fml/lib/FML/Command/Admin/list.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: list.pm,v 1.12 2003/01/26 03:14:17 fukachan Exp $ +# $FML: list.pm,v 1.13 2003/01/27 00:02:41 fukachan Exp $ # package FML::Command::Admin::list; @@ -92,7 +92,7 @@ sub _show_list $maplist = $config->get_as_array_ref( 'admin_member_maps' ); } else { - LogWarn("list: unknown type $option"); + $curproc->logwarn("list: unknown type $option"); } } diff --git a/fml/lib/FML/Command/Auth.pm b/fml/lib/FML/Command/Auth.pm index df833689..8392fdbf 100644 --- a/fml/lib/FML/Command/Auth.pm +++ b/fml/lib/FML/Command/Auth.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Auth.pm,v 1.25 2003/03/28 10:32:21 fukachan Exp $ +# $FML: Auth.pm,v 1.26 2003/05/12 10:16:41 fukachan Exp $ # package FML::Command::Auth; @@ -86,7 +86,7 @@ sub permit_admin_member_maps my $match = $cred->is_privileged_member($sender); if ($match) { - Log("found in admin_member_maps"); + $curproc->log("found in admin_member_maps"); return 1; } @@ -106,7 +106,7 @@ sub reject_system_accounts my $match = $cred->match_system_accounts($sender); if ($match) { - Log("reject_system_accounts: matches the sender"); + $curproc->log("reject_system_accounts: matches the sender"); return '__LAST__'; } @@ -180,7 +180,7 @@ sub check_admin_member_password # 1.2 password match ? if ($p_infile eq $p_input) { if ($debug) { - Log("check_admin_member_password: password match"); + $curproc->log("check_admin_member_password: password match"); } $status = 1; last PASSWORD_ENTRY; @@ -192,7 +192,7 @@ sub check_admin_member_password $curproc->unlock($lock_channel); - LogWarn("check_admin_member_password: password not match") unless $status; + $curproc->logwarn("check_admin_member_password: password not match") unless $status; return $status; } @@ -237,20 +237,20 @@ sub change_password if ($obj->find( $address )) { $obj->delete( $address ); if ($obj->error()) { - LogError("cannot delete $address from=$map"); + $curproc->logerror("cannot delete $address from=$map"); } else { - Log("delete $address from=$map"); + $curproc->log("delete $address from=$map"); } } # add $obj->add( $address, [ $cp, "UNIX_CRYPT" ] ) && $status++; if ($obj->error()) { - LogError("cannot add $address to=$map"); + $curproc->logerror("cannot add $address to=$map"); } else { - Log("add password for $address to=$map"); + $curproc->log("add password for $address to=$map"); } $obj->close(); diff --git a/fml/lib/FML/Command/DirUtils.pm b/fml/lib/FML/Command/DirUtils.pm index b083c5ec..f1b00a77 100644 --- a/fml/lib/FML/Command/DirUtils.pm +++ b/fml/lib/FML/Command/DirUtils.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: DirUtils.pm,v 1.12 2003/01/25 09:14:05 fukachan Exp $ +# $FML: DirUtils.pm,v 1.13 2003/01/26 03:11:27 fukachan Exp $ # package FML::Command::DirUtils; @@ -71,7 +71,7 @@ sub dir $opt_ls = $opt; } else { - LogWarn("deny ls options '$opt'"); + $curproc->logwarn("deny ls options '$opt'"); } } @@ -92,7 +92,7 @@ sub dir if (-x $path_ls) { my $eval = "$path_ls $opt_ls $y"; - Log("dir: run \"$eval\""); + $curproc->log("dir: run \"$eval\""); use FileHandle; my $fh = new FileHandle "$eval|"; @@ -102,11 +102,11 @@ sub dir $fh->close(); } else { - LogError("tail to run '$eval'"); + $curproc->logerror("tail to run '$eval'"); } } else { - LogError("\$path_ls is not found"); + $curproc->logerror("\$path_ls is not found"); croak("\$path_ls is not found"); } } diff --git a/fml/lib/FML/Command/FileUtils.pm b/fml/lib/FML/Command/FileUtils.pm index 81941090..b3aaa121 100644 --- a/fml/lib/FML/Command/FileUtils.pm +++ b/fml/lib/FML/Command/FileUtils.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: FileUtils.pm,v 1.11 2003/01/25 09:14:05 fukachan Exp $ +# $FML: FileUtils.pm,v 1.12 2003/02/09 12:31:41 fukachan Exp $ # package FML::Command::FileUtils; @@ -98,18 +98,18 @@ sub remove unlink $file; if (-f $file) { - LogError("fail to remove $file"); + $curproc->logerror("fail to remove $file"); $is_error++; } else { - Log("remove $file"); + $curproc->log("remove $file"); $curproc->reply_message_nl("command.remove_file", "removed $file", { _arg_file => $file } ); } } else { - LogWarn("no such file $file"); + $curproc->logwarn("no such file $file"); $curproc->reply_message_nl("command.no_such_file", "no such file $file", { _arg_file => $file } ); @@ -118,7 +118,7 @@ sub remove } # $file filename is unsafe. stop. else { - LogError("<$file> is insecure"); + $curproc->logerror("<$file> is insecure"); $curproc->reply_message_nl('command.insecure', "insecure input"); croak("remove: insecure argument"); diff --git a/fml/lib/FML/Command/Filter.pm b/fml/lib/FML/Command/Filter.pm index 3dbd3af1..3b56eecc 100644 --- a/fml/lib/FML/Command/Filter.pm +++ b/fml/lib/FML/Command/Filter.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML$ +# $FML: Filter.pm,v 1.1 2003/06/22 16:05:14 fukachan Exp $ # package FML::Command::Filter; @@ -81,7 +81,7 @@ sub check_command_limit } if ( $count > $limit ) { - Log("command_limit: $count > $limit"); + $curproc->log("command_limit: $count > $limit"); } my $r = "number of commands per mail exceeds limit $limit"; @@ -112,7 +112,7 @@ sub check_line_length_limit } if ($match) { - Log("line_length_limit: $match times (\$len > $limit)"); + $curproc->log("line_length_limit: $match times (\$len > $limit)"); } my $r = "too long command (> $limit bytes)\n"; diff --git a/fml/lib/FML/Command/HTMLify.pm b/fml/lib/FML/Command/HTMLify.pm index 34762031..4bcfc92b 100644 --- a/fml/lib/FML/Command/HTMLify.pm +++ b/fml/lib/FML/Command/HTMLify.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: HTMLify.pm,v 1.16 2003/02/16 08:33:09 fukachan Exp $ +# $FML: HTMLify.pm,v 1.17 2003/07/19 12:58:48 fukachan Exp $ # package FML::Command::HTMLify; @@ -74,7 +74,7 @@ sub convert }; my ($is_subdir_exists, $subdirs) = _check_subdir_exists($src_dir); - if ($is_subdir_exists) { Log("looks subdir exists");} + if ($is_subdir_exists) { $curproc->log("looks subdir exists");} if (defined $dst_dir) { unless (-d $dst_dir) { diff --git a/fml/lib/FML/Command/SendFile.pm b/fml/lib/FML/Command/SendFile.pm index 6a9aa30c..30631ab6 100644 --- a/fml/lib/FML/Command/SendFile.pm +++ b/fml/lib/FML/Command/SendFile.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: SendFile.pm,v 1.28 2003/06/29 05:48:12 fukachan Exp $ +# $FML: SendFile.pm,v 1.29 2003/08/23 04:35:29 fukachan Exp $ # package FML::Command::SendFile; @@ -101,7 +101,7 @@ sub send_article my $article = new FML::Article $curproc; my $filepath = $article->filepath($filename); if (-f $filepath) { - Log("send back article $filename"); + $curproc->log("send back article $filename"); $curproc->reply_message( { type => "message/rfc822; charset=$charset", path => $filepath, @@ -116,13 +116,13 @@ sub send_article _arg_article => $filename, } ); - Log("no such file: $filepath"); + $curproc->log("no such file: $filepath"); } } } # invalid argument else { - LogError("send_article: invalid argument $fn"); + $curproc->logerror("send_article: invalid argument $fn"); $is_error = 1; } } @@ -182,7 +182,7 @@ sub send_file my $charset = $config->{ reply_message_charset }; # XXX-TODO: who validate $filename and $filepath ? - Log("send_file: $filepath"); + $curproc->log("send_file: $filepath"); # template substitution: kanji code, $varname expansion et. al. # we prepare file to send back which has proper kanji code et.al. diff --git a/fml/lib/FML/Command/User/chaddr.pm b/fml/lib/FML/Command/User/chaddr.pm index 0692437b..7a7c254b 100644 --- a/fml/lib/FML/Command/User/chaddr.pm +++ b/fml/lib/FML/Command/User/chaddr.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: chaddr.pm,v 1.19 2003/03/18 10:42:44 fukachan Exp $ +# $FML: chaddr.pm,v 1.20 2003/08/23 04:35:32 fukachan Exp $ # package FML::Command::User::chaddr; @@ -112,7 +112,7 @@ sub process # 1. request from $old_addr : $old_addr (member now) -> $new_addr # 2. request from $new_addr : $old_addr -> $new_addr (member now) if ($cred->is_member($old_addr) || $cred->is_member($new_addr)) { - Log("chaddr request, try confirmation"); + $curproc->log("chaddr request, try confirmation"); # XXX-TODO: should be FML::Confirm { ... address => [ @addr ] } ? use FML::Confirm; diff --git a/fml/lib/FML/Command/User/confirm.pm b/fml/lib/FML/Command/User/confirm.pm index 6a5f57aa..18c00da4 100644 --- a/fml/lib/FML/Command/User/confirm.pm +++ b/fml/lib/FML/Command/User/confirm.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: confirm.pm,v 1.21 2003/03/18 10:42:44 fukachan Exp $ +# $FML: confirm.pm,v 1.22 2003/08/23 04:35:33 fukachan Exp $ # package FML::Command::User::confirm; @@ -118,7 +118,7 @@ sub process } else { # if requset is expired $curproc->reply_message_nl('error.expired', "request expired"); - LogError("request expired"); + $curproc->logerror("request expired"); croak("request is expired"); } } @@ -127,7 +127,7 @@ sub process $curproc->reply_message_nl('error.no_such_confirmation', "no such confirmatoin request id=$id", { _arg_id => $id }); - LogError("no such confirmation request id=$id"); + $curproc->logerror("no such confirmation request id=$id"); croak("no such confirmation request id=$id"); } } @@ -162,7 +162,7 @@ sub _switch_command $obj->$class($curproc, $command_args); } else { - LogError("no such rule confirm for '$class' command"); + $curproc->logerror("no such rule confirm for '$class' command"); $curproc->reply_message_nl('error.no_such_confirmation_for_command', "no such confirmation for command $class", { _arg_command => $class }); diff --git a/fml/lib/FML/Command/User/digest.pm b/fml/lib/FML/Command/User/digest.pm index cab3457a..cdb9a227 100644 --- a/fml/lib/FML/Command/User/digest.pm +++ b/fml/lib/FML/Command/User/digest.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: digest.pm,v 1.5 2003/03/18 10:52:34 fukachan Exp $ +# $FML: digest.pm,v 1.6 2003/08/23 04:35:33 fukachan Exp $ # package FML::Command::User::digest; @@ -91,7 +91,7 @@ sub process # if not member, "on" request is wrong. unless ($cred->is_member($address)) { $curproc->reply_message_nl('error.not_member'); - LogError("digest request from not member"); + $curproc->logerror("digest request from not member"); croak("digest request from not member"); return; } @@ -101,7 +101,7 @@ sub process } if ($mode) { - Log("digest $mode"); + $curproc->log("digest $mode"); $command_args->{ command_data } = $address; $command_args->{ options }->[0] = $address; @@ -113,12 +113,12 @@ sub process $obj->process($curproc, $command_args); } else { - LogError("unknown digest mode"); + $curproc->logerror("unknown digest mode"); croak("no such digest mode: off or on"); } } else { - LogError("digest: mode not specified"); + $curproc->logerror("digest: mode not specified"); croak("digest: mode not specified"); } } diff --git a/fml/lib/FML/Command/User/get.pm b/fml/lib/FML/Command/User/get.pm index 30a64438..f787292d 100644 --- a/fml/lib/FML/Command/User/get.pm +++ b/fml/lib/FML/Command/User/get.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: get.pm,v 1.16 2003/03/18 10:42:44 fukachan Exp $ +# $FML: get.pm,v 1.17 2003/06/29 05:48:12 fukachan Exp $ # package FML::Command::User::get; @@ -90,14 +90,14 @@ sub check_limit $curproc->reply_message_nl('command.exceed_total_request_limit', 'total requests exceed limit', $_args); - LogError("get command limit: total=$total_num_req > $limit"); + $curproc->logerror("get command limit: total=$total_num_req > $limit"); return $nreq; } elsif ($nreq > $limit) { $curproc->reply_message_nl('command.exceed_request_limit', 'requests exceed limit', $_args); - LogError("get command limit: $nreq > $limit"); + $curproc->logerror("get command limit: $nreq > $limit"); return $nreq; } else { diff --git a/fml/lib/FML/Command/User/off.pm b/fml/lib/FML/Command/User/off.pm index 2b0f0fef..70bd2d90 100644 --- a/fml/lib/FML/Command/User/off.pm +++ b/fml/lib/FML/Command/User/off.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: off.pm,v 1.8 2003/03/18 10:52:34 fukachan Exp $ +# $FML: off.pm,v 1.9 2003/08/23 04:35:33 fukachan Exp $ # package FML::Command::User::off; @@ -92,7 +92,7 @@ sub process # if not member, off request is wrong. unless ($cred->is_member($address)) { $curproc->reply_message_nl('error.not_member'); - LogError("off request from not member"); + $curproc->logerror("off request from not member"); croak("off request from not member"); return; } @@ -100,12 +100,12 @@ sub process # if not recipient, off request is wrong. unless ($cred->is_recipient($address)) { $curproc->reply_message_nl('error.not_recipient'); - LogError("off request from not recipient"); + $curproc->logerror("off request from not recipient"); croak("off request from not recipient"); } # try confirmation before off else { - Log("off request, try confirmation"); + $curproc->log("off request, try confirmation"); use FML::Confirm; my $confirm = new FML::Confirm { diff --git a/fml/lib/FML/Command/User/on.pm b/fml/lib/FML/Command/User/on.pm index e4ccf73d..f9b7695c 100644 --- a/fml/lib/FML/Command/User/on.pm +++ b/fml/lib/FML/Command/User/on.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: on.pm,v 1.8 2003/03/18 10:52:34 fukachan Exp $ +# $FML: on.pm,v 1.9 2003/08/23 04:35:33 fukachan Exp $ # package FML::Command::User::on; @@ -92,7 +92,7 @@ sub process # if not member, on request is wrong. unless ($cred->is_member($address)) { $curproc->reply_message_nl('error.not_member'); - LogError("on request from not member"); + $curproc->logerror("on request from not member"); croak("on request from not member"); return; } @@ -108,7 +108,7 @@ sub process } # if not, try confirmation before on else { - Log("on request, try confirmation"); + $curproc->log("on request, try confirmation"); use FML::Confirm; my $confirm = new FML::Confirm { keyword => $keyword, diff --git a/fml/lib/FML/Command/User/subscribe.pm b/fml/lib/FML/Command/User/subscribe.pm index eea78644..68cd28dc 100644 --- a/fml/lib/FML/Command/User/subscribe.pm +++ b/fml/lib/FML/Command/User/subscribe.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: subscribe.pm,v 1.19 2003/03/18 10:42:44 fukachan Exp $ +# $FML: subscribe.pm,v 1.20 2003/08/23 04:35:33 fukachan Exp $ # package FML::Command::User::subscribe; @@ -101,7 +101,7 @@ sub process } # if not, try confirmation before subscribe else { - Log("new subscriber, try confirmation"); + $curproc->log("new subscriber, try confirmation"); use FML::Confirm; my $confirm = new FML::Confirm { keyword => $keyword, diff --git a/fml/lib/FML/Command/User/unsubscribe.pm b/fml/lib/FML/Command/User/unsubscribe.pm index f35e4be6..b771333d 100644 --- a/fml/lib/FML/Command/User/unsubscribe.pm +++ b/fml/lib/FML/Command/User/unsubscribe.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: unsubscribe.pm,v 1.19 2003/03/18 10:42:44 fukachan Exp $ +# $FML: unsubscribe.pm,v 1.20 2003/08/23 04:35:33 fukachan Exp $ # package FML::Command::User::unsubscribe; @@ -93,12 +93,12 @@ sub process # if not member, unsubscriber request is wrong. unless ($cred->is_member($address)) { $curproc->reply_message_nl('error.not_member'); - LogError("unsubscribe request from not member"); + $curproc->logerror("unsubscribe request from not member"); croak("unsubscribe request from not member"); } # try confirmation before unsubscribe else { - Log("unsubscribe request, try confirmation"); + $curproc->log("unsubscribe request, try confirmation"); use FML::Confirm; my $confirm = new FML::Confirm { diff --git a/fml/lib/FML/Command/UserControl.pm b/fml/lib/FML/Command/UserControl.pm index 10c4699f..1f6e41ba 100644 --- a/fml/lib/FML/Command/UserControl.pm +++ b/fml/lib/FML/Command/UserControl.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: UserControl.pm,v 1.31 2003/03/23 15:57:52 fukachan Exp $ +# $FML: UserControl.pm,v 1.32 2003/03/28 10:32:21 fukachan Exp $ # package FML::Command::UserControl; @@ -103,7 +103,7 @@ sub useradd $obj->touch(); # create a new map entry (e.g. file) if needed. $obj->add( $address ); unless ($obj->error()) { - Log("add $address to map=$_map"); + $curproc->log("add $address to map=$_map"); $curproc->reply_message_nl('command.add_ok', "$address added.", $msg_args); @@ -128,7 +128,7 @@ sub useradd } unless ($trycount) { - LogError("no trail to add $address"); + $curproc->logerror("no trail to add $address"); } } @@ -184,7 +184,7 @@ sub userdel my $obj = new IO::Adapter $map, $config; $obj->delete( $address_in_map ); unless ($obj->error()) { - Log("remove $address from map=$_map"); + $curproc->log("remove $address from map=$_map"); $curproc->reply_message_nl('command.del_ok', "$address removed.", $msg_args); @@ -198,7 +198,7 @@ sub userdel } } else { - LogWarn("no such user in map=$_map") if $debug; + $curproc->logwarn("no such user in map=$_map") if $debug; } } @@ -208,7 +208,7 @@ sub userdel } unless ($trycount) { - LogError("no trail to remove $address"); + $curproc->logerror("no trail to remove $address"); } } @@ -273,7 +273,7 @@ sub _try_chaddr_in_map $is_new_address_ok = 1; } else { - LogError("$new_address is already member (map=$map)"); + $curproc->logerror("$new_address is already member (map=$map)"); return 0; } @@ -296,10 +296,10 @@ sub _try_chaddr_in_map $obj->open(); $obj->add( $new_address ); unless ($obj->error()) { - Log("add $new_address to map=$map"); + $curproc->log("add $new_address to map=$map"); } else { - LogError("fail to add $new_address to map=$map"); + $curproc->logerror("fail to add $new_address to map=$map"); } $obj->close(); } @@ -313,10 +313,10 @@ sub _try_chaddr_in_map $obj->open(); $obj->delete( $old_address_in_map ); unless ($obj->error()) { - Log("delete $old_address from map=$map"); + $curproc->log("delete $old_address from map=$map"); } else { - LogError("fail to delete $old_address to map=$map"); + $curproc->logerror("fail to delete $old_address to map=$map"); } $obj->close(); } @@ -358,7 +358,7 @@ sub userlist $obj->close; } else { - LogWarn("canot open $map"); + $curproc->logwarn("canot open $map"); } } diff --git a/fml/lib/FML/Error/Analyze.pm b/fml/lib/FML/Error/Analyze.pm index e6756b35..8f9d85b9 100644 --- a/fml/lib/FML/Error/Analyze.pm +++ b/fml/lib/FML/Error/Analyze.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Analyze.pm,v 1.21 2003/05/28 14:33:43 fukachan Exp $ +# $FML: Analyze.pm,v 1.22 2003/08/23 04:35:34 fukachan Exp $ # package FML::Error::Analyze; @@ -138,7 +138,7 @@ sub AUTOLOAD $fp =~ s/.*:://; my $pkg = "FML::Error::Analyze::${fp}"; - Log("load $pkg") if 1; # debug + $curproc->log("load $pkg") if 1; # debug my $analyzer = undef; eval qq{ use $pkg; \$analyzer = new $pkg;}; @@ -149,12 +149,12 @@ sub AUTOLOAD $self->{ _analyzer } = $analyzer; } else { - LogError("${pkg} has no process method"); + $curproc->logerror("${pkg} has no process method"); } } else { - LogError($@) if $@; - LogError("$pkg module is not found"); + $curproc->logerror($@) if $@; + $curproc->logerror("$pkg module is not found"); croak("$pkg module is not found"); # upcall to FML::Error } } diff --git a/fml/lib/FML/Error/Analyze/histgram.pm b/fml/lib/FML/Error/Analyze/histgram.pm index 9a5525a0..41304f77 100644 --- a/fml/lib/FML/Error/Analyze/histgram.pm +++ b/fml/lib/FML/Error/Analyze/histgram.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: histgram.pm,v 1.2 2003/05/28 14:33:44 fukachan Exp $ +# $FML: histgram.pm,v 1.3 2003/08/23 04:35:35 fukachan Exp $ # package FML::Error::Analyze::histgram; @@ -151,7 +151,7 @@ sub _histgram } my $array = __debug_printable_array($ra); - Log("summary: $addr sum=$sum ($array)"); + $curproc->log("summary: $addr sum=$sum ($array)"); push(@removelist, $addr) if $sum >= $limit; } } diff --git a/fml/lib/FML/Filter.pm b/fml/lib/FML/Filter.pm index 3941fdc1..512260a3 100644 --- a/fml/lib/FML/Filter.pm +++ b/fml/lib/FML/Filter.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Filter.pm,v 1.31 2003/07/18 12:55:27 fukachan Exp $ +# $FML: Filter.pm,v 1.32 2003/08/23 04:35:27 fukachan Exp $ # package FML::Filter; @@ -75,12 +75,12 @@ sub article_filter FUNCTION: for my $function (@$functions) { if ($config->yes( "use_${function}" )) { - Log("filter(debug): check by $function") if $debug; + $curproc->log("filter(debug): check by $function") if $debug; my $fp = "_apply_$function"; $status = $self->$fp($curproc, $args, $message); } else { - Log("filter(debug): not check by $function") if $debug; + $curproc->log("filter(debug): not check by $function") if $debug; } last FUNCTION if $status; @@ -251,7 +251,7 @@ sub _apply_article_mime_component_filter $obj->mime_component_check($mesg); } else { - Log("(debug) disabled since rule file not found") if $debug; + $curproc->log("(debug) disabled since rule file not found") if $debug; return 0; } @@ -322,7 +322,7 @@ sub _filter_reject_notice $msg_args->{ _arg_address } = $cred->sender(); $msg_args->{ _arg_size } = $size; - Log("filter notice: [ @$rcpts ]"); + $curproc->log("filter notice: [ @$rcpts ]"); $curproc->reply_message_nl("error.reject_post", "your post is rejected.", @@ -348,7 +348,7 @@ sub _filter_reject_notice $curproc->reply_message(sprintf("\n\n%s", $s), $msg_args); } else { - LogError("unknown ${class}_filter_reject_notice_data_type: $type"); + $curproc->logerror("unknown ${class}_filter_reject_notice_data_type: $type"); } } @@ -375,12 +375,12 @@ sub command_mail_filter FUNCTION: for my $function (@$functions) { if ($config->yes( "use_${function}" )) { - Log("filter(debug): check by $function") if $debug; + $curproc->log("filter(debug): check by $function") if $debug; my $fp = "_apply_$function"; $status = $self->$fp($curproc, $args, $message); } else { - Log("filter(debug): not check by $function") if $debug; + $curproc->log("filter(debug): not check by $function") if $debug; } last FUNCTION if $status; diff --git a/fml/lib/FML/Parse.pm b/fml/lib/FML/Parse.pm index 1ea86857..f721850e 100644 --- a/fml/lib/FML/Parse.pm +++ b/fml/lib/FML/Parse.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Parse.pm,v 1.28 2002/12/18 04:34:41 fukachan Exp $ +# $FML: Parse.pm,v 1.29 2003/01/11 06:58:45 fukachan Exp $ # package FML::Parse; @@ -72,7 +72,7 @@ sub _parse # log information my $header_size = $msg->whole_message_header_size(); my $body_size = $msg->whole_message_body_size(); - Log("read header=$header_size body=$body_size"); + $curproc->log("read header=$header_size body=$body_size"); if (defined $msg->envelope_sender()) { my $pcb = $curproc->{ pcb }; @@ -80,7 +80,7 @@ sub _parse $pcb->set('credential', 'unix-from', $msg->envelope_sender()); } else { - LogError("parse: pcb not defined"); + $curproc->logerror("parse: pcb not defined"); } } diff --git a/fml/lib/FML/Process/Addr.pm b/fml/lib/FML/Process/Addr.pm index f3f76a63..9de628a6 100644 --- a/fml/lib/FML/Process/Addr.pm +++ b/fml/lib/FML/Process/Addr.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Addr.pm,v 1.8 2003/08/23 04:35:37 fukachan Exp $ +# $FML: Addr.pm,v 1.9 2003/08/23 04:43:40 fukachan Exp $ # package FML::Process::Addr; @@ -78,14 +78,14 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmladdr_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); $curproc->fix_perl_include_path(); $eval = $config->get_hook( 'fmladdr_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -102,7 +102,7 @@ sub verify_request my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmladdr_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } if (0) { print STDERR "Error: missing argument(s)\n"; @@ -111,7 +111,7 @@ sub verify_request } $eval = $config->get_hook( 'fmladdr_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -153,10 +153,10 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmladdr_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $eval = $config->get_hook( 'fmladdr_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -214,7 +214,7 @@ sub _fmladdr my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmladdr_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # show only accounts if -n option specified. my $mode = $args->{ options }->{ n } ? 'fmlonly' : 'all'; @@ -242,7 +242,7 @@ sub _fmladdr } $eval = $config->get_hook( 'fmladdr_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } diff --git a/fml/lib/FML/Process/Alias.pm b/fml/lib/FML/Process/Alias.pm index 99c4637d..5d242036 100644 --- a/fml/lib/FML/Process/Alias.pm +++ b/fml/lib/FML/Process/Alias.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Alias.pm,v 1.9 2003/08/23 04:35:37 fukachan Exp $ +# $FML: Alias.pm,v 1.10 2003/08/23 04:43:41 fukachan Exp $ # package FML::Process::Alias; @@ -74,14 +74,14 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmlalias_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); $curproc->fix_perl_include_path(); $eval = $config->get_hook( 'fmlalias_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -98,7 +98,7 @@ sub verify_request my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmlalias_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } if (0) { print STDERR "Error: missing argument(s)\n"; @@ -107,7 +107,7 @@ sub verify_request } $eval = $config->get_hook( 'fmlalias_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -147,10 +147,10 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmlalias_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $eval = $config->get_hook( 'fmlalias_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -212,7 +212,7 @@ sub _fmlalias my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmlalias_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # show fmlonly aliases if -n option specified. my $mode = $args->{ options }->{ n } ? 'fmlonly' : 'all'; @@ -229,7 +229,7 @@ sub _fmlalias } $eval = $config->get_hook( 'fmlalias_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } diff --git a/fml/lib/FML/Process/CGI/Kernel.pm b/fml/lib/FML/Process/CGI/Kernel.pm index 032124e2..ee87a033 100644 --- a/fml/lib/FML/Process/CGI/Kernel.pm +++ b/fml/lib/FML/Process/CGI/Kernel.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Kernel.pm,v 1.49 2003/02/16 09:45:08 fukachan Exp $ +# $FML: Kernel.pm,v 1.50 2003/08/23 04:35:41 fukachan Exp $ # package FML::Process::CGI::Kernel; @@ -244,9 +244,9 @@ sub _error_string eval q{ use FML::Log qw(Log LogError); - LogError($r); + $curproc->logerror($r); my ($k, $v); - while (($k, $v) = each %ENV) { Log("$k => $v");} + while (($k, $v) = each %ENV) { $curproc->log("$k => $v");} }; } @@ -347,7 +347,7 @@ sub cgi_execute_command my $config = $curproc->config(); unless ($config->has_attribute("commands_for_admin_cgi", $comname)) { - LogError("cgi deny command: mode=$commode level=cgi"); + $curproc->logerror("cgi deny command: mode=$commode level=cgi"); # XXX-TODO: validate $comname (CSS). my $buf = $curproc->message_nl("cgi.deny", @@ -357,7 +357,7 @@ sub cgi_execute_command return; } else { - Log("run $comname mode=$commode level=cgi"); + $curproc->log("run $comname mode=$commode level=cgi"); } use FML::Command; diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm index f5895b1f..a4a7461f 100644 --- a/fml/lib/FML/Process/Command.pm +++ b/fml/lib/FML/Process/Command.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Command.pm,v 1.86 2003/05/14 12:02:01 fukachan Exp $ +# $FML: Command.pm,v 1.87 2003/08/23 04:35:38 fukachan Exp $ # package FML::Process::Command; @@ -78,7 +78,7 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'command_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); @@ -89,12 +89,12 @@ sub prepare $curproc->parse_incoming_message($args); } else { - LogError("use of command_mail_program prohibited"); + $curproc->logerror("use of command_mail_program prohibited"); exit(0); } $eval = $config->get_hook( 'command_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -115,7 +115,7 @@ sub verify_request my $config = $curproc->{ config }; my $eval = $config->get_hook( 'command_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->verify_sender_credential(); @@ -124,7 +124,7 @@ sub verify_request } $eval = $config->get_hook( 'command_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -149,19 +149,19 @@ sub _check_filter _arg_reason => $r, }; - Log("(debug) filter: inform rejection"); + $curproc->log("(debug) filter: inform rejection"); $filter->command_mail_filter_reject_notice($curproc,$msg_args); } else { - Log("filter: not inform rejection"); + $curproc->log("filter: not inform rejection"); } # we should stop this process ASAP. $curproc->stop_this_process(); - Log("rejected by filter due to $r"); + $curproc->log("rejected by filter due to $r"); } }; - Log($@) if $@; + $curproc->log($@) if $@; } @@ -190,7 +190,7 @@ sub run my $config = $curproc->{ config }; my $eval = $config->get_hook( 'command_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } unless ($curproc->is_refused()) { # permit_xxx() sets the error reason at "check_restriction" in pcb. @@ -222,14 +222,14 @@ sub run $curproc->reply_message_add_header_info(); unless (defined $reason) { $reason = 'unknown';} - Log("deny command. reason=$reason"); + $curproc->log("deny command. reason=$reason"); } } else { - LogError("ignore this request."); + $curproc->logerror("ignore this request."); } $eval = $config->get_hook( 'command_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -275,13 +275,13 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'command_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->inform_reply_messages(); $curproc->queue_flush(); $eval = $config->get_hook( 'command_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -329,7 +329,7 @@ sub _config_permit_command } else { if ($level eq 'admin' || $level eq 'user') { - Log("commands_for_$level has no $comname"); + $curproc->log("commands_for_$level has no $comname"); $curproc->reply_message("\n$prompt $command"); $curproc->reply_message_nl('command.not_command', "not command, ignored."); @@ -338,7 +338,7 @@ sub _config_permit_command ; # ignored. } else { - LogWarn("unknown level=$level"); + $curproc->logwarn("unknown level=$level"); } return 0; @@ -366,7 +366,7 @@ sub _is_safe_syntax } else { if ($level eq 'admin') { - LogError("insecure command: $command"); + $curproc->logerror("insecure command: $command"); $curproc->reply_message("\n$prompt $command"); $curproc->reply_message_nl('command.insecure', "insecure, so ignored."); @@ -375,7 +375,7 @@ sub _is_safe_syntax ; # ignored. } else { - LogWarn("unknown level=$level"); + $curproc->logwarn("unknown level=$level"); } return 0; @@ -455,20 +455,20 @@ sub _try_admin_auth # reject as soon as possible if ($is_auth eq '__LAST__') { - Log("admin: rejected by $rule"); + $curproc->log("admin: rejected by $rule"); return 0; } elsif ($is_auth) { - Log("admin: auth by $rule"); + $curproc->log("admin: auth by $rule"); return $is_auth; } else { - Log("admin: not match rule=$rule") if $debug; + $curproc->log("admin: not match rule=$rule") if $debug; } } } else { - LogError("fail to load FML::Command::Auth"); + $curproc->logerror("fail to load FML::Command::Auth"); return 0; } @@ -531,17 +531,17 @@ sub _get_command_mode } else { # no, we do not accept this command. - Log("invalid command: $command"); + $curproc->log("invalid command: $command"); return '__NEXT__'; } } # Case: "admin" command is exceptional. try priviledged mode. elsif ($command =~ /$admin_prefix\s+/) { if ($is_auth) { - Log("admin: auth-ed already. run <$command>") if $debug; + $curproc->log("admin: auth-ed already. run <$command>") if $debug; } else { # for the first time ? - Log("admin: try auth"); + $curproc->log("admin: try auth"); my $sender = $curproc->{'credential'}->{'sender'}; my $data = $command; @@ -553,7 +553,7 @@ sub _get_command_mode # XXX simple state machine: update $status->{ is_auth } $is_auth = $curproc->_try_admin_auth($args, $optargs); $status->{ is_auth } = $is_auth; - Log("admin: o.k. auth-ed as an ML admin") if $is_auth; + $curproc->log("admin: o.k. auth-ed as an ML admin") if $is_auth; } if ($is_admin && $is_auth) { @@ -571,7 +571,7 @@ sub _get_command_mode } else { # no, we do not accept this command. - Log("invalid command(priv mode): $command"); + $curproc->log("invalid command(priv mode): $command"); return '__NEXT__'; } } @@ -585,7 +585,7 @@ sub _get_command_mode elsif ((! $is_admin) && $is_auth) { $status->{ _stop_reason_key } = 'error.not_admin_member'; $status->{ _stop_reason_str } = "not admin member."; - LogError("not admin member"); + $curproc->logerror("not admin member"); } # other reasons else { @@ -593,14 +593,14 @@ sub _get_command_mode $status->{ _stop_reason_str } = "not authenticated."; } - LogError("admin command not authenticated"); + $curproc->logerror("admin command not authenticated"); return '__LAST__'; } } # ignore all requests except for confirm command # when we receive "confirm" command for better security. elsif ($is_confirm) { - Log("ignore(confirm stage): $command"); + $curproc->log("ignore(confirm stage): $command"); return '__NEXT__'; } # Case: use command (commands "a usual member" can use) @@ -613,7 +613,7 @@ sub _get_command_mode } else { # no, we do not accept this command. - Log("invalid command: $command"); + $curproc->log("invalid command: $command"); return '__NEXT__'; } } @@ -627,13 +627,13 @@ sub _get_command_mode # XXX invalid condition is satisfied. # XXX emergency stop if admin mode. if ($status->{ level } eq 'admin') { - LogError("command from not member."); - LogError("command processing stop."); + $curproc->logerror("command from not member."); + $curproc->logerror("command processing stop."); return '__LAST__'; } # XXX but just ignore this commnad unless admin mode. else { - Log("(debug) ignore $command") if $debug; + $curproc->log("(debug) ignore $command") if $debug; return '__NEXT__'; } } @@ -658,13 +658,13 @@ sub _config_allow_command my $config = $curproc->config(); my $level = $status->{ level }; - Log("(debug) mode=$mode level=$level") if $debug; + $curproc->log("(debug) mode=$mode level=$level") if $debug; if ($config->has_attribute("commands_for_${level}", $comname)) { - Log("(debug) $comname o.k. under mode=$mode level=$level") if $debug; + $curproc->log("(debug) $comname o.k. under mode=$mode level=$level") if $debug; } else { - Log("deny command: mode=$mode level=$level"); + $curproc->log("deny command: mode=$mode level=$level"); return 0; } @@ -795,7 +795,7 @@ sub _evaluate_command_lines my $eval = $config->get_hook( 'command_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # firstly, prompt (for politeness :) to show processing ... $curproc->reply_message("result for your command requests follows:"); @@ -811,7 +811,7 @@ sub _evaluate_command_lines $num_total++; # the total numer of non null lines - Log("(debug) input: $orig_command") if $debug; # log raw buffer + $curproc->log("(debug) input: $orig_command") if $debug; # log raw buffer # Example: if orig_command = "# help", comname = "help" $fixed_command = __clean_up($orig_command); @@ -824,7 +824,7 @@ sub _evaluate_command_lines next COMMAND; } elsif ($mode eq '__LAST__') { - LogError("command processing stop."); + $curproc->logerror("command processing stop."); $curproc->__stop_here($args, $status, $cominfo, $orig_command); last COMMAND; } @@ -837,7 +837,7 @@ sub _evaluate_command_lines # 1.3 valid mode unless ($mode eq 'user' || $mode eq 'admin') { - LogError("command processing stop."); + $curproc->logerror("command processing stop."); $curproc->__stop_here($args, $status, $cominfo, $orig_command); last COMMAND; } @@ -846,21 +846,21 @@ sub _evaluate_command_lines unless ($curproc->_config_allow_command($mode, $status, $cominfo)) { $curproc->reply_message_nl("command.deny", "\tyou cannot use this command."); - Log("(debug) ignore $fixed_command"); + $curproc->log("(debug) ignore $fixed_command"); $num_ignored++; next COMMAND; } # 3. simple syntax check unless ($curproc->_is_safe_syntax($args, $status, $cominfo)) { - LogError("invalid/unsafe syntax"); - Log("(debug) ignore $fixed_command"); + $curproc->logerror("invalid/unsafe syntax"); + $curproc->log("(debug) ignore $fixed_command"); $num_ignored++; next COMMAND; } # o.k. here we go to execute this command - Log("execute \"$fixed_command\"") if $debug; + $curproc->log("execute \"$fixed_command\"") if $debug; $num_processed++; use FML::Command; @@ -889,7 +889,7 @@ sub _evaluate_command_lines # reply buffer $curproc->reply_message("\n$prompt $orig_command", $msg_args); - Log($orig_command); + $curproc->log($orig_command); # execute command ($comname method) under eval(). # XXX $obj = FML::Command object NOT FML::Command::$mode::$command @@ -903,21 +903,21 @@ sub _evaluate_command_lines } else { # error trap my $reason = $@; - Log($reason); + $curproc->log($reason); $curproc->reply_message_nl('command.fail', "fail.", $msg_args); - LogError("command ${comname} fail"); + $curproc->logerror("command ${comname} fail"); if ($reason =~ /^(.*)\s+at\s+/) { my $reason = $1; - Log($reason); # pick up reason + $curproc->log($reason); # pick up reason } } } } # END OF FOR LOOP: for my $orig_command (@body) { ... } $eval = $config->get_hook( 'command_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # info $curproc->reply_message("\ncommand processing results:"); @@ -938,7 +938,7 @@ sub _evaluate_command_lines if (keys %cc_recipient) { for my $k (keys %cc_recipient) { my $ra_addr = $cc_recipient{ $k }; - Log("msg.cc: [ @$ra_addr ]"); + $curproc->log("msg.cc: [ @$ra_addr ]"); $curproc->reply_message( $msg , { recipient => $ra_addr }); } } diff --git a/fml/lib/FML/Process/Configure.pm b/fml/lib/FML/Process/Configure.pm index 00452d95..c8fa69fa 100644 --- a/fml/lib/FML/Process/Configure.pm +++ b/fml/lib/FML/Process/Configure.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Configure.pm,v 1.52 2003/08/23 04:35:38 fukachan Exp $ +# $FML: Configure.pm,v 1.53 2003/08/23 04:43:41 fukachan Exp $ # package FML::Process::Configure; @@ -75,7 +75,7 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'makefml_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->close_stderr_channel_if_quiet_option_specified(); $curproc->resolve_ml_specific_variables( $args ); @@ -83,7 +83,7 @@ sub prepare $curproc->fix_perl_include_path(); $eval = $config->get_hook( 'makefml_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -100,7 +100,7 @@ sub verify_request my $config = $curproc->{ config }; my $eval = $config->get_hook( 'makefml_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } if ($len <= 1) { $curproc->help(); @@ -108,7 +108,7 @@ sub verify_request } $eval = $config->get_hook( 'makefml_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -151,10 +151,10 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'makefml_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $eval = $config->get_hook( 'makefml_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -299,7 +299,7 @@ sub _makefml }; my $eval = $config->get_hook( 'makefml_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # here we go require FML::Command; @@ -315,18 +315,18 @@ sub _makefml } else { my $r = $@; - LogError("command $method fail"); - LogError($r); + $curproc->logerror("command $method fail"); + $curproc->logerror($r); if ($r =~ /^(.*)\s+at\s+/) { my $reason = $1; - Log($reason); # pick up reason + $curproc->log($reason); # pick up reason croak($reason); } } } $eval = $config->get_hook( 'makefml_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } diff --git a/fml/lib/FML/Process/Digest.pm b/fml/lib/FML/Process/Digest.pm index 357bab22..c6d7187d 100644 --- a/fml/lib/FML/Process/Digest.pm +++ b/fml/lib/FML/Process/Digest.pm @@ -3,7 +3,7 @@ # Copyright (C) 2002 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Digest.pm,v 1.7 2003/08/23 04:35:38 fukachan Exp $ +# $FML: Digest.pm,v 1.8 2003/08/23 04:43:41 fukachan Exp $ # package FML::Process::Digest; @@ -79,7 +79,7 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'digest_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); @@ -87,12 +87,12 @@ sub prepare $curproc->scheduler_init(); unless ($config->yes('use_digest_program')) { - LogError("use of digest_program prohibited"); + $curproc->logerror("use of digest_program prohibited"); exit(0); } $eval = $config->get_hook( 'digest_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -114,7 +114,7 @@ sub verify_request my $maintainer = $config->{ maintainer }; my $eval = $config->get_hook( 'digest_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # set sender against further errors my $cred = new FML::Credential $curproc; @@ -122,7 +122,7 @@ sub verify_request $curproc->{'credential'}->set( 'sender', $maintainer ); $eval = $config->get_hook( 'digest_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -153,19 +153,19 @@ sub run my $sender = $curproc->{'credential'}->{'sender'}; my $eval = $config->get_hook( 'digest_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->lock(); unless ($curproc->is_refused()) { $curproc->_digest($args); } else { - LogError("ignore this request."); + $curproc->logerror("ignore this request."); } $curproc->unlock(); $eval = $config->get_hook( 'digest_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -210,13 +210,13 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'digest_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->inform_reply_messages(); $curproc->queue_flush(); $eval = $config->get_hook( 'digest_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -248,7 +248,7 @@ sub _digest $digest->set_digest_id($aid); } else { - Log("no articles to send as digest"); + $curproc->log("no articles to send as digest"); } } diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm index cfe8f121..7c0cdcb2 100644 --- a/fml/lib/FML/Process/Distribute.pm +++ b/fml/lib/FML/Process/Distribute.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Distribute.pm,v 1.122 2003/08/23 04:35:39 fukachan Exp $ +# $FML: Distribute.pm,v 1.123 2003/08/23 04:43:41 fukachan Exp $ # package FML::Process::Distribute; @@ -78,7 +78,7 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'distribute_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); @@ -89,12 +89,12 @@ sub prepare $curproc->parse_incoming_message($args); } else { - LogError("use of distribute_program prohibited"); + $curproc->logerror("use of distribute_program prohibited"); exit(0); } $eval = $config->get_hook( 'distribute_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -118,7 +118,7 @@ sub verify_request my $config = $curproc->{ config }; my $eval = $config->get_hook( 'distribute_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->verify_sender_credential(); @@ -131,7 +131,7 @@ sub verify_request } $eval = $config->get_hook( 'distribute_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -156,19 +156,19 @@ sub _check_filter _arg_reason => $r, }; - Log("(debug) filter: inform rejection"); + $curproc->log("(debug) filter: inform rejection"); $filter->article_filter_reject_notice($curproc, $msg_args); } else { - Log("filter: not inform rejection"); + $curproc->log("filter: not inform rejection"); } # we should stop this process ASAP. $curproc->stop_this_process(); - Log("rejected by filter due to $r"); + $curproc->log("rejected by filter due to $r"); } }; - Log($@) if $@; + $curproc->log($@) if $@; } @@ -207,7 +207,7 @@ sub run }; my $eval = $config->get_hook( 'distribute_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # $curproc->lock(); unless ($curproc->is_refused()) { @@ -217,7 +217,7 @@ sub run else { my $pcb = $curproc->{ pcb }; - Log("deny article submission"); + $curproc->log("deny article submission"); my $rule = $pcb->get("check_restrictions", "deny_reason"); if ($rule eq 'reject_system_accounts') { @@ -270,13 +270,13 @@ sub run } } else { - LogError("ignore this request."); + $curproc->logerror("ignore this request."); } # $curproc->unlock(); $eval = $config->get_hook( 'distribute_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -321,13 +321,13 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'distribute_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->inform_reply_messages(); $curproc->queue_flush(); $eval = $config->get_hook( 'distribute_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -363,7 +363,7 @@ sub _distribute # XXX debug, remove here in the future if ($debug) { my $ha_msg = $curproc->{ article }->{ body }->data_type_list; - for my $msg (@$ha_msg) { Log("debug: $msg");} + for my $msg (@$ha_msg) { $curproc->log("debug: $msg");} } # thread system checks the message before header rewritings. @@ -390,7 +390,7 @@ sub _distribute $curproc->_deliver_article($args); if ($config->yes('use_html_archive')) { - Log("htmlify article $id"); + $curproc->log("htmlify article $id"); $curproc->_htmlify($args); } } @@ -427,7 +427,7 @@ sub _header_rewrite my $id = $args->{ id }; for my $rule (@$rules) { - Log("_header_rewrite( $rule )") if $config->yes('debug'); + $curproc->log("_header_rewrite( $rule )") if $config->yes('debug'); if ($header->can($rule)) { # See FML::Header and FML::Header::* $header->$rule($config, { # for methods themself @@ -436,7 +436,7 @@ sub _header_rewrite }); } else { - LogError("header->$rule is undefined"); + $curproc->logerror("header->$rule is undefined"); } } } @@ -456,18 +456,18 @@ sub _deliver_article my $body = $curproc->article_message_body(); # Mail::Message object unless ( $config->yes( 'use_article_delivery' ) ) { - Log("not delivery (\$use_article_delivery = no)"); + $curproc->log("not delivery (\$use_article_delivery = no)"); return; } # SMTP-FROM is a must! unless ( $config->{'maintainer'} ) { - Log("not delivery for undefined \$maintainer"); + $curproc->log("not delivery for undefined \$maintainer"); return; } # distribute article - my $fp = sub { Log(@_);}; # pointer to the log function + my $fp = sub { $curproc->log(@_);}; # pointer to the log function my $sfp = sub { my ($s) = @_; print $s; print "\n" if $s !~ /\n$/o;}; my $handle = undef; @@ -490,7 +490,7 @@ sub _deliver_article }; croak($@) if $@; - if ($service->error) { Log($service->error); return;} + if ($service->error) { $curproc->log($service->error); return;} # XXX_LOCK_CHANNEL: recipient_map_modify my $lock_channel = "recipient_map_modify"; @@ -509,7 +509,7 @@ sub _deliver_article }); $curproc->unlock($lock_channel); - if ($service->error) { Log($service->error); return;} + if ($service->error) { $curproc->log($service->error); return;} } @@ -548,7 +548,7 @@ sub _old_thread_check my $thread = new Mail::ThreadTrack $ttargs; $thread->analyze($msg); }; - Log($@) if $@; + $curproc->log($@) if $@; } @@ -609,17 +609,17 @@ sub _htmlify unless ($@) { unless (-d $html_dir) { $curproc->mkdir($html_dir, "mode=public"); - LogError("fail to mkdir $html_dir") unless -d $html_dir; + $curproc->logerror("fail to mkdir $html_dir") unless -d $html_dir; } eval q{ my $obj = new Mail::Message::ToHTML $_tdb_args; $obj->htmlify_file($article_file, $_tdb_args); }; - LogError($@) if $@; + $curproc->logerror($@) if $@; } else { - LogError($@) if $@; + $curproc->logerror($@) if $@; } $curproc->reset_umask(); diff --git a/fml/lib/FML/Process/DocViewer.pm b/fml/lib/FML/Process/DocViewer.pm index 9ead6935..910f7c1d 100644 --- a/fml/lib/FML/Process/DocViewer.pm +++ b/fml/lib/FML/Process/DocViewer.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: DocViewer.pm,v 1.23 2003/01/11 16:05:17 fukachan Exp $ +# $FML: DocViewer.pm,v 1.24 2003/08/23 04:35:39 fukachan Exp $ # package FML::Process::DocViewer; @@ -78,14 +78,14 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmldoc_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); $curproc->fix_perl_include_path(); $eval = $config->get_hook( 'fmldoc_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -101,7 +101,7 @@ sub verify_request my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmldoc_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } if (length(@$argv) == 0) { $curproc->help(); @@ -109,7 +109,7 @@ sub verify_request } $eval = $config->get_hook( 'fmldoc_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -149,7 +149,7 @@ sub _fmldoc my $argv = $curproc->command_line_argv(); my $eval = $config->get_hook( 'fmldoc_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } my (@opts); push(@opts, '-v') if $args->{ options }->{ v }; @@ -167,7 +167,7 @@ sub _fmldoc croak($@); $eval = $config->get_hook( 'fmldoc_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -219,10 +219,10 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmldoc_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $eval = $config->get_hook( 'fmldoc_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } diff --git a/fml/lib/FML/Process/Error.pm b/fml/lib/FML/Process/Error.pm index 855a9012..d71a32da 100644 --- a/fml/lib/FML/Process/Error.pm +++ b/fml/lib/FML/Process/Error.pm @@ -3,7 +3,7 @@ # Copyright (C) 2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Error.pm,v 1.31 2003/05/03 03:23:43 fukachan Exp $ +# $FML: Error.pm,v 1.32 2003/08/23 04:35:39 fukachan Exp $ # package FML::Process::Error; @@ -74,7 +74,7 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'error_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); @@ -89,7 +89,7 @@ sub prepare } $eval = $config->get_hook( 'error_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -111,7 +111,7 @@ sub verify_request my $maintainer = $config->{ maintainer }; my $eval = $config->get_hook( 'error_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # set dummy sender to avoid unexpected error use FML::Credential; @@ -120,7 +120,7 @@ sub verify_request $curproc->{'credential'}->set( 'sender', $maintainer ); $eval = $config->get_hook( 'error_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -151,7 +151,7 @@ sub run my $msg = $curproc->incoming_message(); my $eval = $config->get_hook( 'error_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->_forward_error_message(); @@ -170,9 +170,9 @@ sub run my $reason = $bouncer->reason( $address ); if ($address) { - Log("bounced: address=<$address>"); - Log("bounced: status=$status"); - Log("bounced: reason=\"$reason\""); + $curproc->log("bounced: address=<$address>"); + $curproc->log("bounced: status=$status"); + $curproc->log("bounced: reason=\"$reason\""); $error->add({ address => $address, @@ -186,7 +186,7 @@ sub run $error->db_close(); }; - LogError($@) if $@; + $curproc->logerror($@) if $@; if ($found) { $pcb->set("error", "found", 1); @@ -195,7 +195,7 @@ sub run } $eval = $config->get_hook( 'error_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -210,7 +210,7 @@ sub _clean_up_bouncers my $channel = 'erroranalyzer'; if ($curproc->is_event_timeout($channel)) { - Log("(debug) event timeout"); + $curproc->log("(debug) event timeout"); eval q{ use FML::Error; @@ -218,12 +218,12 @@ sub _clean_up_bouncers $error->analyze(); $error->remove_bouncers(); }; - LogError($@) if $@; + $curproc->logerror($@) if $@; $curproc->set_event_timeout($channel, time + 3600); } else { - Log("(debug) event not timeout"); + $curproc->log("(debug) event not timeout"); } } @@ -271,21 +271,21 @@ sub finish my $pcb = $curproc->{ pcb }; my $eval = $config->get_hook( 'error_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } if ($pcb->get("error", "found")) { - Log("error message found"); + $curproc->log("error message found"); # inform ? } else { - Log("error message not found"); + $curproc->log("error message not found"); } $curproc->inform_reply_messages(); $curproc->queue_flush(); $eval = $config->get_hook( 'error_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } diff --git a/fml/lib/FML/Process/HTMLify.pm b/fml/lib/FML/Process/HTMLify.pm index 5c8b83fd..53c280c9 100644 --- a/fml/lib/FML/Process/HTMLify.pm +++ b/fml/lib/FML/Process/HTMLify.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: HTMLify.pm,v 1.27 2003/01/11 16:05:19 fukachan Exp $ +# $FML: HTMLify.pm,v 1.28 2003/08/23 04:35:39 fukachan Exp $ # package FML::Process::HTMLify; @@ -69,14 +69,14 @@ sub prepare my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmlhtmlify_prepare_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $curproc->resolve_ml_specific_variables( $args ); $curproc->load_config_files( $args->{ cf_list } ); $curproc->fix_perl_include_path(); $eval = $config->get_hook( 'fmlhtmlify_prepare_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -90,10 +90,10 @@ sub verify_request my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmlhtmlify_verify_request_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $eval = $config->get_hook( 'fmlhtmlify_verify_request_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -120,7 +120,7 @@ sub run print STDERR "htmlify\n\t$src_dir =>\n\t$dst_dir\n" if $debug; my $eval = $config->get_hook( 'fmlhtmlify_run_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } # prepend $opt_I as @INC if (defined $options->{ I }) { @@ -136,7 +136,7 @@ sub run }); $eval = $config->get_hook( 'fmlhtmlify_run_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } @@ -171,10 +171,10 @@ sub finish my $config = $curproc->{ config }; my $eval = $config->get_hook( 'fmlhtmlify_finish_start_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } $eval = $config->get_hook( 'fmlhtmlify_finish_end_hook' ); - if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } + if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm index bde2e54a..ff4d3193 100644 --- a/fml/lib/FML/Process/Kernel.pm +++ b/fml/lib/FML/Process/Kernel.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Kernel.pm,v 1.173 2003/08/23 04:35:39 fukachan Exp $ +# $FML: Kernel.pm,v 1.174 2003/08/23 05:29:01 fukachan Exp $ # package FML::Process::Kernel; @@ -175,7 +175,7 @@ sub _signal_init $SIG{'ALRM'} = $SIG{'INT'} = $SIG{'QUIT'} = $SIG{'TERM'} = sub { my ($signal) = @_; - Log("SIG$signal trapped"); + $curproc->log("SIG$signal trapped"); sleep 1; croak("SIG$signal trapped"); }; @@ -272,7 +272,7 @@ sub lock if (defined $LockInfo{ $channel } && $LockInfo{ $channel }) { my @c = caller; - LogWarn( "channel=$channel already locked ($c[0] $c[1])" ); + $curproc->logwarn( "channel=$channel already locked ($c[0] $c[1])" ); return; } @@ -286,15 +286,15 @@ sub lock if ($r) { my $t = time - $time_in; if ($t > 1) { - Log("lock requires $t sec."); + $curproc->log("lock requires $t sec."); } $pcb->set('lock', $channel, $lockobj); $LockInfo{ $channel } = 1; - Log("lock channel=$channel"); + $curproc->log("lock channel=$channel"); } else { - LogError("cannot lock"); + $curproc->logerror("cannot lock"); croak("Error: cannot lock"); } } @@ -321,19 +321,19 @@ sub unlock if ($r) { my $t = time - $time_in; if ($t > 1) { - Log("unlock requires $t sec."); + $curproc->log("unlock requires $t sec."); } delete $LockInfo{ $channel }; - Log("unlock channel=$channel"); + $curproc->log("unlock channel=$channel"); } else { - LogError("cannot unlock"); + $curproc->logerror("cannot unlock"); croak("Error: cannot unlock"); } } else { - LogError("object undefined, cannot unlock"); + $curproc->logerror("object undefined, cannot unlock"); croak("Error: object undefined, cannot unlock"); } } @@ -401,7 +401,7 @@ sub is_event_timeout return (time > $t) ? 1 : 0; } else { - LogWarn("visit timeout channel=$channel at the first time"); + $curproc->logwarn("visit timeout channel=$channel at the first time"); return 1; } } @@ -508,23 +508,23 @@ sub verify_sender_credential } else { $curproc->stop_this_process("cannot extract From:"); - LogError("cannot extract From:"); + $curproc->logerror("cannot extract From:"); } # XXX "@addrs must be empty" is valid since From: is unique. if (@addrs) { - LogWarn("invalid From: duplicated addresses"); - LogWarn("use $from as the sender"); + $curproc->logwarn("invalid From: duplicated addresses"); + $curproc->logwarn("use $from as the sender"); my $i = 0; for my $a ($addr, @addrs) { my $s = $a->address; ++$i; - LogWarn("From[$i] $s"); + $curproc->logwarn("From[$i] $s"); } } if ($from) { - Log("sender: $from"); + $curproc->log("sender: $from"); # check $from should match safe address regexp. use FML::Restriction::Base; @@ -538,12 +538,12 @@ sub verify_sender_credential } else { $curproc->stop_this_process(); - LogError("unsafe From: $from"); + $curproc->logerror("unsafe From: $from"); } } else { $curproc->stop_this_process(); - LogError("no valid From:"); + $curproc->logerror("no valid From:"); } } @@ -575,7 +575,7 @@ sub simple_loop_check $match = $header->$rule($config, $args) ? $rule : 0; } else { - Log("header->${rule}() is undefined"); + $curproc->log("header->${rule}() is undefined"); } last RULE if $match; @@ -584,7 +584,7 @@ sub simple_loop_check if ($match) { # we should stop this process ASAP. $curproc->stop_this_process(); - LogError("mail loop detected for $match"); + $curproc->logerror("mail loop detected for $match"); } } @@ -721,7 +721,7 @@ sub resolve_ml_specific_variables # parse the argument such as "fml.pl /var/spool/ml/elena ..." unless ($ml_name) { - Log("(debug) parse @ARGV"); + $curproc->log("(debug) parse @ARGV"); ARGS: for my $arg (@ARGV) { @@ -740,7 +740,7 @@ sub resolve_ml_specific_variables $config->set( 'ml_domain', $default_domain ); $config->set( 'ml_home_dir', $arg ); - Log("(debug) ml_name=$ml_name ml_home_dir=$ml_home_dir"); + $curproc->log("(debug) ml_name=$ml_name ml_home_dir=$ml_home_dir"); } } } @@ -768,11 +768,11 @@ sub __debug_ml_xxx my $config = $curproc->{ config }; if (defined $config->{ log_file } && (-w $config->{ log_file })) { - for my $buf (@delayed_buffer) { Log( $buf ); } + for my $buf (@delayed_buffer) { $curproc->log( $buf ); } @delayed_buffer = (); for my $var (qw(ml_name ml_domain ml_home_prefix ml_home_dir)) { - Log(sprintf("%-25s = %s", '(debug)'.$str. $var, + $curproc->log(sprintf("%-25s = %s", '(debug)'.$str. $var, (defined $config->{ $var } ? $config->{ $var } : ''))); } } @@ -873,7 +873,7 @@ sub load_config_files use FML::Credential; my $cred = new FML::Credential $curproc; if ($cred->is_same_address($maintainer, $ml_address)) { - LogError("invalid configuration: \$maintainer == \$address_for_post"); + $curproc->logerror("invalid configuration: \$maintainer == \$address_for_post"); $curproc->stop_this_process("configuration error"); } } @@ -1021,11 +1021,11 @@ sub _check_restrictions } else { ($match, $result) = (0, undef); - LogWarn("unknown rule=$rule"); + $curproc->logwarn("unknown rule=$rule"); } if ($match) { - Log("match rule=$rule sender=$sender"); + $curproc->log("match rule=$rule sender=$sender"); return($result eq "permit" ? 1 : 0); } } @@ -1109,6 +1109,98 @@ sub close_stderr_channel_if_quiet_option_specified =head1 MESSAGE HANDLING +=head2 log_message($msg, $msg_args) + +? + log(STR) log_message(STR, { level => "ok" }) + logwarn(STR) log_message(STR, { level => "warning" }) + logerror(STR) log_message(STR, { level => "error" }) + +=head2 log($msg, $msg_args) + +=head2 logwarn($msg, $msg_args) + +=head2 logerror($msg, $msg_args) + +=cut + + +# Descriptions: log message +# Arguments: OBJ($curproc) STR($msg) HASH_REF($msg_args) +# Side Effects: none +# Return Value: none +sub log_message +{ + my ($curproc, $msg, $msg_args) = @_; + my $_msg_args = $msg_args->{ msg_args }; + my $level = $msg_args->{ level }; + my $at_package = $msg_args->{ caller }->[ 0 ]; + my $at_function = $msg_args->{ caller }->[ 1 ]; + my $at_line = $msg_args->{ caller }->[ 2 ]; + + if ($level eq 'ok') { + Log($msg); + } + elsif ($level eq 'warning') { + LogWarn($msg); + } + elsif ($level eq 'error') { + LogError($msg); + } +} + + +# Descriptions: log message +# Arguments: OBJ($curproc) STR($msg) HASH_REF($msg_args) +# Side Effects: none +# Return Value: none +sub log +{ + my ($curproc, $msg, $msg_args) = @_; + my (@c) = caller; + + $curproc->log_message($msg, { + msg_args => $msg_args, + level => 'ok', + caller => \@c, + }); +} + + +# Descriptions: log message as warning. +# Arguments: OBJ($curproc) STR($msg) HASH_REF($msg_args) +# Side Effects: none +# Return Value: none +sub logwarn +{ + my ($curproc, $msg, $msg_args) = @_; + my (@c) = caller; + + $curproc->log_message($msg, { + msg_args => $msg_args, + level => 'warning', + caller => \@c, + }); +} + + +# Descriptions: log message as error. +# Arguments: OBJ($curproc) STR($msg) HASH_REF($msg_args) +# Side Effects: none +# Return Value: none +sub logerror +{ + my ($curproc, $msg, $msg_args) = @_; + my (@c) = caller; + + $curproc->log_message($msg, { + msg_args => $msg_args, + level => 'error', + caller => \@c, + }); +} + + =head2 reply_message($msg) C<reply_message($msg)> holds message C<$msg> sent back to the mail @@ -1159,7 +1251,7 @@ sub reply_message if ($myname eq 'makefml' || $myname eq 'fml' || $myname =~ /\.cgi$/) { - LogWarn("(debug) $myname disables reply_message()"); + $curproc->logwarn("(debug) $myname disables reply_message()"); return; } @@ -1191,7 +1283,7 @@ sub reply_message } if (_array_is_different($sent, $recipient)) { - Log("cc: [ @$recipient ]"); + $curproc->log("cc: [ @$recipient ]"); $curproc->_append_message_into_queue($msg, $args, $recipient, $recipient_maps, $hdr); @@ -1221,7 +1313,7 @@ sub _analyze_recipients $recipient = [ $rcpt ] if $rcpt; } else { - LogError("reply_message: wrong type recipient"); + $curproc->logerror("reply_message: wrong type recipient"); } } @@ -1230,7 +1322,7 @@ sub _analyze_recipients $recipient_maps = [ $map ] if $map; } else { - LogError("reply_message: wrong type recipient_map"); + $curproc->logerror("reply_message: wrong type recipient_map"); } } @@ -1239,7 +1331,7 @@ sub _analyze_recipients $recipient_maps = $maps if @$maps; } else { - LogError("reply_message: wrong type recipient_maps"); + $curproc->logerror("reply_message: wrong type recipient_maps"); } } @@ -1374,7 +1466,7 @@ sub _reply_message_recipient_keys $rcptlist = $m->{ recipient }; $rcptmaps = $m->{ recipient_maps }; $type = ref($m->{ message }); - $key = _gen_recipient_key( $rcptlist, $rcptmaps ); + $key = $curproc->_gen_recipient_key( $rcptlist, $rcptmaps ); $rcptattr{ $key }->{ $type }++; $rcptlist{ $key } = $rcptlist; $rcptmaps{ $key } = $rcptmaps; @@ -1392,7 +1484,7 @@ sub _reply_message_recipient_keys # Return Value: STR sub _gen_recipient_key { - my ($rarray, $rmaps) = @_; + my ($curproc, $rarray, $rmaps) = @_; my (@c) = caller; my $key = ''; @@ -1403,7 +1495,7 @@ sub _gen_recipient_key } } else { - LogError("wrong \$rarray"); + $curproc->logerror("wrong \$rarray"); } } @@ -1414,7 +1506,7 @@ sub _gen_recipient_key } } else { - LogError("wrong \$rmaps"); + $curproc->logerror("wrong \$rmaps"); } } @@ -1462,7 +1554,7 @@ sub reply_message_nl my $obj = new Mail::Message::Encode; $curproc->reply_message( $obj->convert( $buf, 'jis-jp' ), $args); }; - LogError($@) if $@; + $curproc->logerror($@) if $@; } else { $curproc->reply_message($default_msg, $args); @@ -1519,7 +1611,7 @@ sub message_nl } } else { - LogWarn("no such file: $file"); + $curproc->logwarn("no such file: $file"); } return $buf; @@ -1533,7 +1625,7 @@ sub message_nl sub caller_info { my ($curproc, $msg, $pkg, $fn, $line) = @_; - Log("msg='$msg' $fn $line"); + $curproc->log("msg='$msg' $fn $line"); } @@ -1670,10 +1762,10 @@ sub queue_in } - Log("debug: queue_in: sender=$sender"); - Log("debug: queue_in: recipient=$rcptkey"); - Log("debug: queue_in: rcptlist=[ @$rcptlist ]"); - Log("debug: queue_in: is_multipart=$is_multipart"); + $curproc->log("debug: queue_in: sender=$sender"); + $curproc->log("debug: queue_in: recipient=$rcptkey"); + $curproc->log("debug: queue_in: rcptlist=[ @$rcptlist ]"); + $curproc->log("debug: queue_in: is_multipart=$is_multipart"); ############################################################### @@ -1706,8 +1798,8 @@ sub queue_in for my $m ( @$mesg_queue ) { my $q = $m->{ message }; my $t = $m->{ type }; - my $r = _gen_recipient_key($m->{ recipient }, - $m->{ recipient_maps } ); + my $r = $curproc->_gen_recipient_key($m->{ recipient }, + $m->{ recipient_maps } ); # pick up only messages returned to specified $rcptkey next QUEUE unless $r eq $rcptkey; @@ -1730,8 +1822,8 @@ sub queue_in for my $m ( @$mesg_queue ) { my $q = $m->{ message }; my $t = $m->{ type }; - my $r = _gen_recipient_key($m->{ recipient }, - $m->{ recipient_maps } ); + my $r = $curproc->_gen_recipient_key($m->{ recipient }, + $m->{ recipient_maps } ); next QUEUE unless $r eq $rcptkey; @@ -1746,8 +1838,8 @@ sub queue_in Disposition => $q->{ disposition }); } else { - # Log("queue_in: type=<$t> aggregated") if $t eq 'text'; - Log("queue_in: unknown type=<$t>") unless $t eq 'text'; + # $curproc->log("queue_in: type=<$t> aggregated") if $t eq 'text'; + $curproc->log("queue_in: unknown type=<$t>") unless $t eq 'text'; } } } @@ -1762,8 +1854,8 @@ sub queue_in for my $m ( @$mesg_queue ) { my $q = $m->{ message }; my $t = $m->{ type }; - my $r = _gen_recipient_key($m->{ recipient }, - $m->{ recipient_maps }); + my $r = $curproc->_gen_recipient_key($m->{ recipient }, + $m->{ recipient_maps }); next QUEUE unless $r eq $rcptkey; @@ -1775,7 +1867,7 @@ sub queue_in $s .= $q; } else { - Log("queue_in: unknown typ $t"); + $curproc->log("queue_in: unknown typ $t"); } } } @@ -1820,12 +1912,12 @@ sub queue_in $queue->set('recipient_maps', $rcptmaps); } - $queue->in( $msg ) && Log("queue=$qid in"); + $queue->in( $msg ) && $curproc->log("queue=$qid in"); if ($queue->setrunnable()) { - Log("queue=$qid runnable"); + $curproc->log("queue=$qid runnable"); } else { - Log("queue=$qid broken"); + $curproc->log("queue=$qid broken"); } # return queue object @@ -1853,7 +1945,7 @@ sub _append_rfc822_message $wh->close; } else { - LogError("_append_rfc822_message: cannot create \$tmpfile"); + $curproc->logerror("_append_rfc822_message: cannot create \$tmpfile"); } if (-f $tmpfile) { @@ -1866,13 +1958,13 @@ sub _append_rfc822_message $rh->close; } else { - LogError("_append_rfc822_message: cannot open \$tmpfile"); + $curproc->logerror("_append_rfc822_message: cannot open \$tmpfile"); } $curproc->add_into_clean_up_queue( $tmpfile ); } else { - LogError("_append_rfc822_message: \$tmpfile not found"); + $curproc->logerror("_append_rfc822_message: \$tmpfile not found"); } } @@ -1906,7 +1998,7 @@ sub clean_up_tmpfiles if (defined $queue) { for my $q (@$queue) { - Log("unlink $q") if $debug; + $curproc->log("unlink $q") if $debug; unlink $q; } } @@ -2041,7 +2133,7 @@ sub prepare_file_to_return } } else { - LogError("Mail::Message::Encode object undef"); + $curproc->logerror("Mail::Message::Encode object undef"); } close($wh); @@ -2158,13 +2250,13 @@ sub finalize my $debug = $curproc->debug_level(); if ($debug > 100) { - Log("debug: dump curproc structure"); + $curproc->log("debug: dump curproc structure"); eval q{ use FML::Process::Debug; my $obj = new FML::Process::Debug; $obj->dump_curproc($curproc); }; - LogError($@) if $@; + $curproc->logerror($@) if $@; } } diff --git a/fml/lib/FML/Process/QMail.pm b/fml/lib/FML/Process/QMail.pm index 89e0e50f..2d839638 100644 --- a/fml/lib/FML/Process/QMail.pm +++ b/fml/lib/FML/Process/QMail.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: QMail.pm,v 1.14 2002/09/22 14:56:53 fukachan Exp $ +# $FML: QMail.pm,v 1.15 2002/12/18 04:43:52 fukachan Exp $ # package FML::Process::QMail; @@ -73,11 +73,11 @@ sub DotQmailExt my $ext = $ENV{'EXT'}; unless ($ext) { - Log("no extension address"); + $curproc->log("no extension address"); return; } - &Log("dot-qmail-ext[0]: $ext"); + &$curproc->log("dot-qmail-ext[0]: $ext"); my ($key) = (split(/\@/, $config->{ address_for_post }))[0]; my ($keyctl) = (split(/\@/, $config->{ address_for_command }))[0]; @@ -88,12 +88,12 @@ sub DotQmailExt return ''; } - &Log("dot-qmail-ext: $ext"); + &$curproc->log("dot-qmail-ext: $ext"); $ext =~ s/^$key//i; $ext =~ s/\-\-/\@/i; # since @ cannot be used $ext =~ s/\-/ /g; $ext =~ s/\@/-/g; - &Log("\$ext -> $ext"); + &$curproc->log("\$ext -> $ext"); # XXX: "# command" is internal represention return sprintf("# %s", $ext); diff --git a/fml/lib/FML/Process/QueueManager.pm b/fml/lib/FML/Process/QueueManager.pm index 21e75149..65fe87df 100644 --- a/fml/lib/FML/Process/QueueManager.pm +++ b/fml/lib/FML/Process/QueueManager.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: QueueManager.pm,v 1.12 2003/03/18 10:38:33 fukachan Exp $ +# $FML: QueueManager.pm,v 1.13 2003/08/23 04:35:40 fukachan Exp $ # package FML::Process::QueueManager; @@ -94,12 +94,12 @@ sub send } else { # XXX-TODO: $q->remove() if invalid queue ? - Log("$qid is invalid"); + $curproc->log("$qid is invalid"); } $q->unlock(); } else { - Log("$qid is locked. retry"); + $curproc->log("$qid is locked. retry"); } } } @@ -132,10 +132,10 @@ sub _send }); if ($r) { - Log("queue=$qid status=sent"); + $curproc->log("queue=$qid status=sent"); } else { - Log("queue=$qid status=fail"); + $curproc->log("queue=$qid status=fail"); } return $r; diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm index 3a5c50b3..20c73b2c 100644 --- a/fml/lib/FML/Process/Utils.pm +++ b/fml/lib/FML/Process/Utils.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Utils.pm,v 1.70 2003/08/14 13:43:08 tmu Exp $ +# $FML: Utils.pm,v 1.71 2003/08/20 23:40:29 fukachan Exp $ # package FML::Process::Utils; @@ -213,7 +213,7 @@ sub article_message_header return $curproc->{ article }->{ header }; } else { - LogError("\$curproc->{ article }->{ header } not defined"); + $curproc->logerror("\$curproc->{ article }->{ header } not defined"); return undef; } } @@ -231,7 +231,7 @@ sub article_message_body return $curproc->{ article }->{ body }; } else { - LogError("\$curproc->{ article }->{ body } not defined"); + $curproc->logerror("\$curproc->{ article }->{ body } not defined"); return undef; } } @@ -249,7 +249,7 @@ sub article_message return $curproc->{ article }->{ message }; } else { - LogError("\$curproc->{ article }->{ message } not defined"); + $curproc->logerror("\$curproc->{ article }->{ message } not defined"); return undef; } } @@ -294,18 +294,18 @@ sub mkdir _mkpath_str($dir, $config->{ $xmode }); } else { - LogError("mkdir: invalid mode"); + $curproc->logerror("mkdir: invalid mode"); } } else { - LogError("mkdir: invalid mode"); + $curproc->logerror("mkdir: invalid mode"); } } elsif ($dirmode =~ /^\d+$/) { # STR 0700 _mkpath_str($dir, $dirmode); } else { - LogError("mkdir: invalid mode"); + $curproc->logerror("mkdir: invalid mode"); } } @@ -1130,7 +1130,7 @@ sub convert_to_mail_address push(@$result, $sender); } else { - LogError("unknown recipient type $rcpt"); + $curproc->logerror("unknown recipient type $rcpt"); } } |
