diff options
| author | fukachan <fukachan> | 2004-12-05 16:19:04 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-12-05 16:19:04 +0000 |
| commit | 90766f6d10ace4f05e689dd32363ef84a6366854 (patch) | |
| tree | 177d4aef3cac4d322b547f920b9f169f7d4f3f04 /fml | |
| parent | 968cb03a8eacc447e78f01b0c12ce4eaeea53d4b (diff) | |
| download | fml8-90766f6d10ace4f05e689dd32363ef84a6366854.tar.gz fml8-90766f6d10ace4f05e689dd32363ef84a6366854.tar.bz2 fml8-90766f6d10ace4f05e689dd32363ef84a6366854.zip | |
define logdebug() to disable log messages.
modified to use proper log$role().
bug fix log messages if needed.
Diffstat (limited to 'fml')
27 files changed, 170 insertions, 147 deletions
diff --git a/fml/lib/FML/Article.pm b/fml/lib/FML/Article.pm index 42cba73f..524b17d4 100644 --- a/fml/lib/FML/Article.pm +++ b/fml/lib/FML/Article.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: Article.pm,v 1.69 2004/08/14 08:12:31 fukachan Exp $ +# $FML: Article.pm,v 1.70 2004/10/28 03:33:48 fukachan Exp $ # package FML::Article; @@ -206,7 +206,7 @@ sub spool_in $curproc->unlock($channel); } else { - $curproc->log("not spool article $id"); + $curproc->log("article: spooling disabled"); } } @@ -229,12 +229,12 @@ sub _try_failover # 1. try link(2). if (link($queue_file, $article_file)) { - $curproc->log("article: linked queue to article file"); + $curproc->logwarn("article: linked queue to article file"); $curproc->log("article $id (faked)"); } # 2. try rename(2). elsif (rename($queue_file, $article_file)) { - $curproc->log("article: renamed queue to article file"); + $curproc->logwarn("article: renamed queue to article file"); $curproc->log("article $id (faked)"); } else { diff --git a/fml/lib/FML/Article/Sequence.pm b/fml/lib/FML/Article/Sequence.pm index ffbf7b75..53f621ed 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.13 2004/05/25 03:45:20 fukachan Exp $ +# $FML: Sequence.pm,v 1.14 2004/07/23 04:10:54 fukachan Exp $ # package FML::Article::Sequence; @@ -167,7 +167,7 @@ sub speculate_max_id $spool_dir = $config->{ spool_dir }; } - $curproc->log("max_id: (debug) scan $spool_dir subdir=$use_subdir"); + $curproc->logdebug("max_id: scan $spool_dir subdir=$use_subdir"); if ($use_subdir) { use DirHandle; @@ -194,7 +194,7 @@ sub speculate_max_id # XXX-TODO wrong? to speculate max_id in subdir spool? $subdir = File::Spec->catfile($spool_dir, $max_subdir); - $curproc->log("max_id: (debug) scan $subdir"); + $curproc->logdebug("max_id: scan $subdir"); $curproc->speculate_max_id($subdir); } } diff --git a/fml/lib/FML/Command/Auth.pm b/fml/lib/FML/Command/Auth.pm index b5d1e511..9c8abf77 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.37 2004/04/27 13:37:48 fukachan Exp $ +# $FML: Auth.pm,v 1.38 2004/06/26 11:33:30 fukachan Exp $ # package FML::Command::Auth; @@ -105,7 +105,7 @@ sub reject_system_special_accounts my $match = $cred->match_system_special_accounts($sender); if ($match) { - $curproc->log("reject_system_special_accounts: matches the sender"); + $curproc->logerror("reject_system_special_accounts: matches the sender"); return '__LAST__'; } @@ -194,7 +194,7 @@ sub check_admin_member_password my $p_input = $crypt->unix_crypt($password, $p_infile); if ($p_infile eq $p_input) { if ($debug) { - $curproc->log("$function: password match"); + $curproc->log("$function: password matched"); } $password_match = 1; $status = 1; @@ -279,7 +279,7 @@ sub change_password $curproc->logerror("cannot delete $address from=$map"); } else { - $curproc->log("delete $address from=$map"); + $curproc->log("remove $address from=$map"); } } } diff --git a/fml/lib/FML/Command/Filter.pm b/fml/lib/FML/Command/Filter.pm index b3c03b7f..f305c7dd 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: Filter.pm,v 1.5 2004/04/23 04:10:30 fukachan Exp $ +# $FML: Filter.pm,v 1.6 2004/06/26 11:47:55 fukachan Exp $ # package FML::Command::Filter; @@ -83,7 +83,7 @@ sub check_command_limit } if ( $count > $limit ) { - $curproc->log("command_limit: $count > $limit"); + $curproc->logerror("command_limit: $count > $limit"); } my $r = "number of commands per mail exceeds limit $limit"; @@ -115,7 +115,7 @@ sub check_line_length_limit } if ($match) { - $curproc->log("line_length_limit: $match times (\$len > $limit)"); + $curproc->logerror("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 1d65c90f..84e0515d 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.24 2004/07/23 13:03:11 fukachan Exp $ +# $FML: HTMLify.pm,v 1.25 2004/07/26 03:24:47 fukachan Exp $ # @@ -55,7 +55,7 @@ sub convert $htmlifier_args->{ output_dir } = $dst_dir; my ($is_subdir_exists, $subdirs) = _check_subdir_exists($src_dir); - if ($is_subdir_exists) { $curproc->log("looks subdir exists");} + if ($is_subdir_exists) { $curproc->logdebug("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 5075d77a..5e008f49 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.40 2004/04/23 04:10:31 fukachan Exp $ +# $FML: SendFile.pm,v 1.41 2004/07/23 13:16:35 fukachan Exp $ # package FML::Command::SendFile; @@ -118,7 +118,7 @@ sub send_article _arg_article => $filename, } ); - $curproc->log("no such file: $filepath"); + $curproc->logerror("no such file: $filepath"); } } } diff --git a/fml/lib/FML/Command/User/admin.pm b/fml/lib/FML/Command/User/admin.pm index 23fbcb40..8d388220 100644 --- a/fml/lib/FML/Command/User/admin.pm +++ b/fml/lib/FML/Command/User/admin.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: admin.pm,v 1.9 2004/06/29 10:02:43 fukachan Exp $ +# $FML: admin.pm,v 1.10 2004/07/23 15:59:04 fukachan Exp $ # package FML::Command::User::admin; @@ -192,15 +192,15 @@ sub _apply_old_admin_command_mail_restrictions # reject as soon as possible if ($is_auth eq '__LAST__') { - $curproc->log("admin: rejected by $rule"); + $curproc->logerror("admin: rejected by $rule"); return 0; } elsif ($is_auth) { - $curproc->log("admin: auth by $rule"); + $curproc->log("admin: authed by $rule"); return $is_auth; } else { - $curproc->log("admin: not match rule=$rule"); + $curproc->logdebug("admin: not match rule=$rule"); } } @@ -232,7 +232,7 @@ sub _apply_new_admin_command_mail_restrictions my ($match, $result) = (0, 0); RULE: for my $rule (@$rules) { - $curproc->log("chech by $rule"); + $curproc->logdebug("chech by $rule"); if ($acl->can($rule)) { # match = matched. return as soon as possible from here. @@ -246,7 +246,7 @@ sub _apply_new_admin_command_mail_restrictions } if ($match) { - $curproc->log("$result rule=$rule"); + $curproc->logdebug("$result rule=$rule"); last RULE; } } @@ -265,12 +265,12 @@ sub _apply_new_admin_command_mail_restrictions return 0; } else { - $curproc->log("unknown result: $result"); + $curproc->logerror("unknown result: $result"); return 0; } } else { - $curproc->log("no match"); + $curproc->logerror("not matched"); return 0; } } diff --git a/fml/lib/FML/Digest.pm b/fml/lib/FML/Digest.pm index 7c0ac4a3..13e911c1 100644 --- a/fml/lib/FML/Digest.pm +++ b/fml/lib/FML/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.19 2004/04/23 04:10:27 fukachan Exp $ +# $FML: Digest.pm,v 1.20 2004/07/23 13:16:31 fukachan Exp $ # package FML::Digest; @@ -216,7 +216,7 @@ sub create_multipart_message $count_ok++; } else { - $curproc->log("no such file: $filepath"); + $curproc->logerror("no such file: $filepath"); $count_err++; } } diff --git a/fml/lib/FML/Error.pm b/fml/lib/FML/Error.pm index 69bd1ce8..8aadcd68 100644 --- a/fml/lib/FML/Error.pm +++ b/fml/lib/FML/Error.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: Error.pm,v 1.31 2004/05/22 06:19:51 fukachan Exp $ +# $FML: Error.pm,v 1.32 2004/07/23 04:03:38 fukachan Exp $ # package FML::Error; @@ -298,13 +298,13 @@ sub is_list_address for my $sysaddr (@$addrs) { if (defined $sysaddr && $sysaddr) { - $curproc->log("check is_same_address($addr, $sysaddr)") if $debug; + $curproc->logdebug("check is_same_address($addr, $sysaddr)"); if ($cred->is_same_address($addr, $sysaddr)) { - $curproc->log("match") if $debug; + $curproc->log("matched") if $debug; $match++; } else { - $curproc->log("not match") if $debug; + $curproc->log("not matched") if $debug; } } } diff --git a/fml/lib/FML/Error/Analyze.pm b/fml/lib/FML/Error/Analyze.pm index 0ca9f0d1..0fe5ba47 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.28 2004/04/23 04:10:33 fukachan Exp $ +# $FML: Analyze.pm,v 1.29 2004/07/23 13:16:37 fukachan Exp $ # package FML::Error::Analyze; @@ -150,7 +150,7 @@ sub AUTOLOAD $fp =~ s/.*:://; my $pkg = "FML::Error::Analyze::${fp}"; - $curproc->log("load $pkg") if 1; # debug + $curproc->logdebug("load $pkg"); my $analyzer = undef; eval qq{ use $pkg; \$analyzer = new $pkg;}; diff --git a/fml/lib/FML/Error/Analyze/histgram.pm b/fml/lib/FML/Error/Analyze/histgram.pm index f102aed5..11e12fa0 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.10 2004/05/22 06:19:52 fukachan Exp $ +# $FML: histgram.pm,v 1.11 2004/07/23 13:16:37 fukachan Exp $ # package FML::Error::Analyze::histgram; @@ -158,7 +158,7 @@ sub _histgram } my $array = _ra_to_str($ra); - $curproc->log("summary: $addr sum=$sum ($array)"); + $curproc->logdebug("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 e67a040c..896796d1 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.42 2004/05/25 04:08:32 fukachan Exp $ +# $FML: Filter.pm,v 1.43 2004/07/23 04:04:07 fukachan Exp $ # package FML::Filter; @@ -82,13 +82,13 @@ sub article_filter FUNCTION: for my $function (@$functions) { if ($config->yes( "use_${function}" )) { - $curproc->log("filter(debug): check by $function") if $debug; + $curproc->log("filter: check by $function") if $debug; my $fp = "_apply_$function"; $status = $self->$fp($curproc, $message); } else { if ($debug) { - $curproc->log("filter(debug): $function check disabled."); + $curproc->log("filter: $function check disabled."); } } @@ -198,7 +198,7 @@ sub _apply_article_non_mime_filter RULE: for my $rule (@$rules) { - $curproc->log("article_non_mime_filter.check $rule") if $debug; + $curproc->log("filter: article_non_mime_filter.check $rule") if $debug; if ($rule eq 'permit') { return 0; @@ -281,7 +281,7 @@ sub _apply_article_mime_component_filter } else { if ($debug) { - $curproc->log("(debug) disabled since rule file not found"); + $curproc->log("filter: disabled since rule file not found"); } return 0; @@ -318,7 +318,7 @@ sub _apply_article_spam_filter DRIVER: for my $driver (@$drivers) { - $curproc->log("call external spam driver: $driver"); + $curproc->logdebug("call external spam driver: $driver"); my $r = $self->_external_article_filter($curproc, $mesg, $driver); if ($r) { # XXX-TODO: $FILTER_ERR_IGNORE ok? @@ -333,7 +333,7 @@ sub _apply_article_spam_filter } } else { - $curproc->log("debug: spam filter disabled"); + $curproc->logdebug("spam filter disabled"); } return 0; @@ -355,7 +355,7 @@ sub _apply_article_virus_filter DRIVER: for my $driver (@$drivers) { - $curproc->log("call external virus driver: $driver"); + $curproc->logdebug("call external virus driver: $driver"); my $r = $self->_external_article_filter($curproc, $mesg, $driver); if ($r) { # XXX-TODO: $FILTER_ERR_IGNORE ok? @@ -370,7 +370,7 @@ sub _apply_article_virus_filter } } else { - $curproc->log("debug: virus filter disabled"); + $curproc->logdebug("virus filter disabled"); } return 0; @@ -525,13 +525,13 @@ sub command_mail_filter FUNCTION: for my $function (@$functions) { if ($config->yes( "use_${function}" )) { - $curproc->log("filter(debug): check by $function") if $debug; + $curproc->log("filter: check by $function") if $debug; my $fp = "_apply_$function"; $status = $self->$fp($curproc, $message); } else { if ($debug) { - $curproc->log("filter(debug): $function check disabled."); + $curproc->log("filter: $function check disabled."); } } diff --git a/fml/lib/FML/Mailer.pm b/fml/lib/FML/Mailer.pm index dfb14d3d..674da739 100644 --- a/fml/lib/FML/Mailer.pm +++ b/fml/lib/FML/Mailer.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: Mailer.pm,v 1.28 2004/05/18 00:37:32 fukachan Exp $ +# $FML: Mailer.pm,v 1.29 2004/07/11 15:43:37 fukachan Exp $ # package FML::Mailer; @@ -108,7 +108,7 @@ sub send $maintainer = $config->{ maintainer } if defined $config; # default log functions - $fp = sub { $curproc->log(@_);}; # pointer to the log function + $fp = sub { $curproc->logdebug(@_);}; # pointer to the log function $sfp = sub { my ($s) = @_; print $s; print "\n" if $s !~ /\n$/o;}; # overwrite smtp log channel diff --git a/fml/lib/FML/Merge.pm b/fml/lib/FML/Merge.pm index f6142fe3..05cba3e1 100644 --- a/fml/lib/FML/Merge.pm +++ b/fml/lib/FML/Merge.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: Merge.pm,v 1.12 2004/09/06 07:05:34 fukachan Exp $ +# $FML: Merge.pm,v 1.13 2004/11/25 12:21:39 fukachan Exp $ # package FML::Merge; @@ -349,7 +349,6 @@ sub speculate_default_config_ph_path else { my $config = $curproc->config(); my $file = $config->{ compat_old_fml_default_config_ph_file }; - $curproc->log("check $file"); if (-f $file) { print STDERR " using $file as default_config.ph\n"; return $file; diff --git a/fml/lib/FML/Parse.pm b/fml/lib/FML/Parse.pm index 505e3cd9..c992dcba 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.33 2004/04/23 04:15:57 fukachan Exp $ +# $FML: Parse.pm,v 1.34 2004/07/11 15:43:37 fukachan Exp $ # package FML::Parse; @@ -71,7 +71,7 @@ sub _parse # log information my $header_size = $msg->whole_message_header_size(); my $body_size = $msg->whole_message_body_size(); - $curproc->log("read header=$header_size body=$body_size"); + $curproc->logdebug("read header=$header_size body=$body_size"); # XXX-TODO: use $curproc->XXX_set_envelope_sender($address). if (defined $msg->envelope_sender()) { diff --git a/fml/lib/FML/Process/CGI/Kernel.pm b/fml/lib/FML/Process/CGI/Kernel.pm index d7267df4..c444dd12 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.82 2004/07/23 15:59:11 fukachan Exp $ +# $FML: Kernel.pm,v 1.83 2004/10/09 12:04:18 fukachan Exp $ # package FML::Process::CGI::Kernel; @@ -210,7 +210,7 @@ sub _cgi_resolve_ml_specific_variables $curproc->append_to_config_files_list($config_cf); } else { - $curproc->log("debug: no ml_name"); + $curproc->logdebug("no ml_name"); } $curproc->__debug_ml_xxx('cgi:'); @@ -228,7 +228,7 @@ sub _cgi_fix_log_file $config->set('ml_home_dir', $config->{ domain_local_tmp_dir }); $config->set('log_file', $config->{ domain_local_log_file }); - $curproc->log("debug: log_file = $config->{ log_file }"); + $curproc->logdebug("log_file = $config->{ log_file }"); } @@ -328,7 +328,7 @@ sub _error_string eval q{ $curproc->logerror($r); my ($k, $v); - while (($k, $v) = each %ENV) { $curproc->log("$k => $v");} + while (($k, $v) = each %ENV) { $curproc->logdebug("$k => $v");} }; } diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm index 2bf03b03..a285a641 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,2004 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Command.pm,v 1.109 2004/07/23 12:58:26 fukachan Exp $ +# $FML: Command.pm,v 1.110 2004/07/23 15:59:08 fukachan Exp $ # package FML::Process::Command; @@ -156,16 +156,16 @@ sub _check_filter _arg_reason => $r, }; - $curproc->log("(debug) filter: inform rejection"); + $curproc->log("filter: inform rejection"); $filter->command_mail_filter_reject_notice($curproc,$msg_args); } else { - $curproc->log("filter: not inform rejection"); + $curproc->logdebug("filter: not inform rejection"); } # we should stop this process ASAP. $curproc->stop_this_process(); - $curproc->log("rejected by filter due to $r"); + $curproc->logerror("rejected by filter due to $r"); } }; $curproc->log($@) if $@; @@ -304,7 +304,7 @@ sub _command_process_loop $num_total++; # the total numer of non null lines if ($debug) { # save raw command buffer. - $curproc->log("(debug) input[$num_total]: $orig_command"); + $curproc->log("command: input[$num_total]: $orig_command"); } # XXX analyze the input command and set the result into $context. @@ -323,7 +323,7 @@ sub _command_process_loop # 1. stop here e.g. we processed "unsubscribe" above, so stop here. if ($curproc->command_context_get_normal_stop()) { $curproc->reply_message_nl('command.stop', "stopped."); - $curproc->log("command processing stop."); + $curproc->logdebug("command processing stop."); last COMMAND; } @@ -355,7 +355,7 @@ sub _command_switch if ($debug) { my $fixed_command = $context->{ fixed_command }; - $curproc->log("execute \"$fixed_command\""); + $curproc->log("command: execute \"$fixed_command\""); } # command restriction rules @@ -392,7 +392,7 @@ sub _command_switch } elsif ($result eq "deny") { $num_error++; - $curproc->log("deny command: $comname"); + $curproc->logerror("deny command: $comname"); $curproc->reply_message("\n$_prompt"); $curproc->restriction_state_reply_reason('command_mail', $msg_args); @@ -403,7 +403,7 @@ sub _command_switch $curproc->reply_message_nl("command.not_command", "no such command.", $msg_args); - $curproc->log("ignore command: $comname"); + $curproc->logdebug("ignore command: $comname"); } } else { @@ -477,7 +477,7 @@ sub _command_execute } else { # error trap my $reason = $@; - $curproc->log($reason); + $curproc->logerror($reason); $num_error++; @@ -486,7 +486,7 @@ sub _command_execute if ($reason =~ /^(.*)\s+at\s+/) { my $reason = $1; - $curproc->log($reason); # pick up reason + $curproc->logerror($reason); # pick up reason } } } diff --git a/fml/lib/FML/Process/Configure.pm b/fml/lib/FML/Process/Configure.pm index b4214b0c..68c79d97 100644 --- a/fml/lib/FML/Process/Configure.pm +++ b/fml/lib/FML/Process/Configure.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002,2003,2004 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Configure.pm,v 1.65 2004/04/23 04:10:36 fukachan Exp $ +# $FML: Configure.pm,v 1.66 2004/07/11 15:43:39 fukachan Exp $ # package FML::Process::Configure; @@ -339,7 +339,7 @@ sub _makefml $curproc->logerror($r); if ($r =~ /^(.*)\s+at\s+/) { my $reason = $1; - $curproc->log($reason); # pick up reason + $curproc->logerror($reason); # pick up reason croak($reason); } } diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm index 762240cb..3efeae0d 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,2004 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Distribute.pm,v 1.156 2004/08/15 10:29:42 fukachan Exp $ +# $FML: Distribute.pm,v 1.157 2004/11/03 23:26:52 fukachan Exp $ # package FML::Process::Distribute; @@ -169,16 +169,16 @@ sub _check_filter _arg_reason => $r, }; - $curproc->log("(debug) filter: inform rejection"); + $curproc->log("article_filter: inform rejection"); $filter->article_filter_reject_notice($curproc, $msg_args); } else { - $curproc->log("filter: not inform rejection"); + $curproc->logdebug("filter: not inform rejection"); } # we should stop this process ASAP. $curproc->stop_this_process(); - $curproc->log("rejected by filter due to $r"); + $curproc->logerror("rejected by filter due to $r"); } }; $curproc->log($@) if $@; @@ -187,7 +187,7 @@ sub _check_filter if ($eval) { eval qq{ $eval; }; $curproc->logwarn($@) if $@; } } else { - $curproc->log("debug: article_filter disabled"); + $curproc->logdebug("article_filter disabled"); } } @@ -237,7 +237,7 @@ sub run $curproc->_deliver_article_prep($args); } else { - $curproc->log("deny article submission"); + $curproc->logerror("deny article submission"); $curproc->stop_this_process(); # send back deny request with the original message. @@ -276,7 +276,7 @@ sub run } } else { - $curproc->logerror("ignore this request."); + $curproc->logwarn("ignore this request."); } # $curproc->unlock(); @@ -383,7 +383,7 @@ sub _deliver_article_prep $curproc->set_article_id($id); } else { - $curproc->log("returned article id=$id"); + $curproc->logerror("returned article id=$id"); $curproc->logerror("article sequence number not updated"); $curproc->unlock($lock_channel); $curproc->exit_as_tempfail(); # XXX LONG JUMP! @@ -393,7 +393,7 @@ sub _deliver_article_prep # XXX debug, remove here in the future if ($debug) { my $ha_msg = $curproc->{ article }->{ body }->data_type_list; - for my $msg (@$ha_msg) { $curproc->log("debug: $msg");} + for my $msg (@$ha_msg) { $curproc->logdebug($msg);} } # thread system checks the message before header rewritings. @@ -428,7 +428,7 @@ sub _deliver_article_prep if ($config->yes('use_html_archive')) { $curproc->log("htmlify article $id"); $curproc->_htmlify(); - $curproc->log("htmlify article $id end"); + $curproc->logdebug("htmlify article $id end"); } } @@ -468,7 +468,7 @@ sub _header_rewrite RULE: for my $rule (@$rules) { - $curproc->log("_header_rewrite( $rule )") if $config->yes('debug'); + $curproc->logdebug("_header_rewrite( $rule )"); if ($header->can($rule)) { # See FML::Header and FML::Header::* $header->$rule($config, { # for methods themself @@ -529,7 +529,7 @@ sub _deliver_article # SMTP-FROM is a must! unless ( $config->{'maintainer'} ) { - $curproc->log("not delivery for undefined \$maintainer"); + $curproc->logerror("not delivery for undefined \$maintainer"); return; } @@ -548,7 +548,7 @@ sub _deliver_article if (defined $queue) { $curproc->lock($lock_channel); - $curproc->log("article: qid=$qid"); + $curproc->logdebug("article: qid=$qid"); $queue->set('sender', $config->{ smtp_sender }); @@ -557,7 +557,7 @@ sub _deliver_article $queue->in($message); my $n = $queue->write_count(); - $curproc->log("queue: size=$n written"); + $curproc->logdebug("queue: size=$n written"); if ($queue->error()) { my $error = $queue->error(); $curproc->logerror("queue: $error"); @@ -567,7 +567,7 @@ sub _deliver_article $queue->lock( { lock_before_runnable => "yes" } ); unless ($queue->setrunnable()) { $curproc->logerror("queue: cannot setrunnable"); - $curproc->log("try to deliver on the fly"); + $curproc->logwarn("try to deliver on the fly"); $fatal = 1; } @@ -575,7 +575,7 @@ sub _deliver_article } # 2. distribute article - my $fp = sub { $curproc->log(@_);}; # pointer to the log function + my $fp = sub { $curproc->logdebug(@_);}; # pointer to the log function my $sfp = sub { my ($s) = @_; print $s; print "\n" if $s !~ /\n$/o;}; my $handle = undef; @@ -633,7 +633,7 @@ sub _deliver_article $curproc->unlock($lock_channel) unless defined $queue; if ($service->error) { - $curproc->log($service->error); + $curproc->logerror($service->error); $curproc->smtp_server_state_set_error(); } @@ -644,7 +644,7 @@ sub _deliver_article if (defined $queue) { $queue->remove(); $queue->unlock(); - $curproc->log("article: qid=$qid removed"); + $curproc->logdebug("article: qid=$qid removed"); } } diff --git a/fml/lib/FML/Process/Error.pm b/fml/lib/FML/Process/Error.pm index 63ffc476..cedf962e 100644 --- a/fml/lib/FML/Process/Error.pm +++ b/fml/lib/FML/Process/Error.pm @@ -3,7 +3,7 @@ # Copyright (C) 2002,2003,2004 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Error.pm,v 1.45 2004/05/22 06:36:44 fukachan Exp $ +# $FML: Error.pm,v 1.46 2004/07/23 13:00:57 fukachan Exp $ # package FML::Process::Error; @@ -214,7 +214,7 @@ sub _clean_up_bouncers my $channel = 'error_mail_analyzer'; if ($curproc->is_event_timeout($channel)) { - $curproc->log("(debug) event timeout"); + $curproc->logdebug("event timeout"); eval q{ use FML::Error; @@ -228,7 +228,7 @@ sub _clean_up_bouncers $curproc->set_event_timeout($channel, time + 3600); } else { - $curproc->log("(debug) event not timeout"); + $curproc->logdebug("event not timeout"); } } @@ -283,7 +283,7 @@ sub finish $curproc->log("error message found"); } else { - $curproc->log("error message not found"); + $curproc->logwarn("error message not found"); } $curproc->inform_reply_messages(); diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm index 95423384..1ec400f9 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.243 2004/11/25 12:25:56 fukachan Exp $ +# $FML: Kernel.pm,v 1.244 2004/11/30 04:14:59 fukachan Exp $ # package FML::Process::Kernel; @@ -364,12 +364,12 @@ sub lock if ($r) { my $t = time - $time_in; if ($t > 1) { - $curproc->log("lock channel=$channel requires $t sec."); + $curproc->logwarn("lock channel=$channel requires $t sec."); } $pcb->set('lock', $channel, $io); $LockInfo{ $channel } = 1; - $curproc->log("lock channel=$channel"); + $curproc->logdebug("lock channel=$channel"); } else { $curproc->logerror("cannot lock"); @@ -399,11 +399,11 @@ sub unlock if ($r) { my $t = time - $time_in; if ($t > 1) { - $curproc->log("unlock requires $t sec."); + $curproc->logwarn("unlock requires $t sec."); } delete $LockInfo{ $channel }; - $curproc->log("unlock channel=$channel"); + $curproc->logdebug("unlock channel=$channel"); } else { $curproc->logerror("cannot unlock"); @@ -652,7 +652,7 @@ sub simple_loop_check $match = $header->$rule($config) ? $rule : 0; } else { - $curproc->log("header->${rule}() is undefined"); + $curproc->logwarn("header->${rule}() is undefined"); } last RULE if $match; @@ -843,7 +843,7 @@ sub resolve_ml_specific_variables # lastly, we need to determine $ml_name and $ml_domain. # parse the argument such as "fml.pl /var/spool/ml/elena ..." unless ($ml_name) { - $curproc->log("(debug) parse @ARGV"); + $curproc->logdebug("parse ARGV = ( @ARGV )"); ARGS: for my $arg (@ARGV) { @@ -869,7 +869,7 @@ sub resolve_ml_specific_variables $config->set( 'ml_home_dir', $arg ); my $s = "ml_name=$ml_name ml_home_dir=$ml_home_dir"; - $curproc->log("(debug) $s"); + $curproc->logdebug("(debug) $s"); } } } @@ -1201,7 +1201,7 @@ sub _store_message_into_incoming_queue } unless ($fatal) { - $curproc->log("queued/incoming: qid=$queue_id read=$total"); + $curproc->logdebug("queued/incoming: qid=$queue_id read=$total"); $curproc->mail_queue_set_incoming_queue($queue); } else { @@ -1222,7 +1222,7 @@ sub _inject_charset_hints my $list = $msg->accept_language_list() || []; my $liststr = join("", @$list); - $curproc->log("hints: charset=\"$charset\" accept_language=[$liststr]"); + $curproc->logdebug("hints: charset=\"$charset\" accept_language=[$liststr]"); # 1. prefer Accept-Language: alyways, ignore Content-Type: in this case. # set $list even if $list == [] to avoid further warning. @@ -1238,7 +1238,7 @@ sub _inject_charset_hints my $char = new Mail::Message::Charset; my $lang = $char->message_charset_to_language($charset); - $curproc->log("hints: \"$charset\" => lang=\"$lang\" as a hint."); + $curproc->logdebug("hints: \"$charset\" => lang=\"$lang\" as a hint."); $curproc->set_language_hint('reply_message', $lang); $curproc->set_language_hint('template_file', $lang); } @@ -1287,7 +1287,7 @@ sub permit_post } if ($match) { - $curproc->log("match rule=$rule sender=$sender"); + $curproc->logdebug("match rule=$rule sender=$sender"); return($result eq "permit" ? 1 : 0); } } @@ -1464,6 +1464,9 @@ sub log_message elsif ($level eq 'error') { LogError($msg); } + elsif ($level eq 'debug') { + Log($msg); + } # update message queue $curproc->_log_message_queue_append({ @@ -1529,6 +1532,25 @@ sub logerror } +# Descriptions: log message as debug. +# Arguments: OBJ($curproc) STR($msg) HASH_REF($msg_args) +# Side Effects: none +# Return Value: none +sub logdebug +{ + my ($curproc, $msg, $msg_args) = @_; + my (@c) = caller; + + if (0) { + $curproc->log_message($msg, { + msg_args => $msg_args, + level => 'debug', + caller => \@c, + }); + } +} + + # Descriptions: informational message CUI shows logged # and forwarded into STDERR. # Arguments: OBJ($curproc) STR($msg) HASH_REF($msg_args) @@ -1945,7 +1967,7 @@ sub reply_message_nl }; my $s = "lang=$lang charset=($rm_charset, $tf_charset) class=$class"; - $curproc->log("reply_message_nl: $s") if $rm_debug; + $curproc->logdebug("reply_message_nl: $s") if $rm_debug; $curproc->_reply_message_nl($class, $default_msg, $rm_args, $charsets); } } @@ -2140,7 +2162,8 @@ sub get_preferred_languages my $p = $curproc->__find_preferred_languages($pref_order, $acpt_lang_list, $mime_lang); - $curproc->log("hints: preferred language = [ @$p ]") unless $first_time++; + $curproc->logdebug("hints: preferred language = [ @$p ]") + unless $first_time++; return $p; } @@ -2205,8 +2228,9 @@ sub __find_preferred_languages print STDERR " mime language = \" $orig_mime_lang \"\n"; print STDERR "preferred languge = [ @$selected ]\n"; print STDERR "\n"; - $curproc->log("pref_order=[@$pref_order] acpt=[@$acpt_lang_list]"); - $curproc->log("mime_lang=$orig_mime_lang selected=[@$selected]"); + $curproc->logdebug("pref_order=[@$pref_order]"); + $curproc->logdebug("acpt lang =[@$acpt_lang_list]"); + $curproc->logdebug("mime_lang=$orig_mime_lang selected=[@$selected]"); } if (@$selected) { @@ -2354,7 +2378,7 @@ sub queue_in my @lang = keys %lang_count; if ($#lang > 0) { - $curproc->log("plural languages, so use mulitpart"); + $curproc->logdebug("plural languages, so use mulitpart"); $is_multipart = 1; } } @@ -2377,10 +2401,10 @@ sub queue_in } - $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"); + $curproc->logdebug("queue_in: sender=$sender"); + $curproc->logdebug("queue_in: recipient=$rcptkey"); + $curproc->logdebug("queue_in: rcptlist=[ @$rcptlist ]"); + $curproc->logdebug("queue_in: is_multipart=$is_multipart"); ############################################################### @@ -2466,7 +2490,7 @@ sub queue_in } else { # $curproc->log("queue_in: type=<$t> aggregated") if $t eq 'text'; - $curproc->log("queue_in: unknown type=<$t>") unless $t eq 'text'; + $curproc->logerror("queue_in: unknown type=<$t>") unless $t eq 'text'; } } } @@ -2494,7 +2518,7 @@ sub queue_in $s .= $q; } else { - $curproc->log("queue_in: unknown typ $t"); + $curproc->logerror("queue_in: unknown type $t"); } } } @@ -2539,12 +2563,12 @@ sub queue_in $queue->set('recipient_maps', $rcptmaps); } - $queue->in( $msg ) && $curproc->log("queued/new: qid=$qid"); + $queue->in( $msg ) && $curproc->logdebug("queued/new: qid=$qid"); if ($queue->setrunnable()) { - $curproc->log("queued/active: qid=$qid runnable"); + $curproc->logdebug("queued/active: qid=$qid runnable"); } else { - $curproc->log("queue: qid=$qid broken"); + $curproc->logerror("queue: qid=$qid broken"); } # return queue object @@ -2623,7 +2647,7 @@ sub clean_up_tmpfiles if (defined $queue) { for my $q (@$queue) { - $curproc->log("unlink $q"); + $curproc->logdebug("unlink $q"); unlink $q; } } @@ -3034,7 +3058,7 @@ sub finalize } if ($debug > 100) { - $curproc->log("debug: dump curproc structure"); + $curproc->logdebug("debug: dump curproc structure"); eval q{ use FML::Process::Debug; my $obj = new FML::Process::Debug; diff --git a/fml/lib/FML/Process/QueueManager.pm b/fml/lib/FML/Process/QueueManager.pm index 5c5233ca..8632d962 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.29 2004/09/03 13:56:42 fukachan Exp $ +# $FML: QueueManager.pm,v 1.30 2004/09/04 03:14:17 fukachan Exp $ # package FML::Process::QueueManager; @@ -84,7 +84,7 @@ sub send my $count_ok = 0; my $count_err = 0; my $channel = 'qmgr_reschedule'; - my $fp = sub { $curproc->log(@_);}; + my $fp = sub { $curproc->logdebug(@_);}; use Mail::Delivery::Queue; my $queue = new Mail::Delivery::Queue { directory => $queue_dir }; @@ -99,7 +99,7 @@ sub send $queue->set_policy("fair-queue"); $ra = $queue->list(); unless (@$ra) { - $curproc->log("qmgr: empty active queue. re-schedule"); + $curproc->logdebug("qmgr: empty active queue. re-schedule"); $queue->reschedule(); $ra = $queue->list(); } @@ -125,7 +125,7 @@ sub send $count_ok++; } else { - $curproc->log("qmgr: qid=$qid try later."); + $curproc->logwarn("qmgr: qid=$qid try later."); $q->unlock(); $q->sleep_queue(); $is_locked = 0; @@ -135,13 +135,13 @@ sub send } else { # XXX-TODO: $q->remove() if invalid queue ? - $curproc->log("qmgr: qid=$qid is invalid"); + $curproc->logerror("qmgr: qid=$qid is invalid"); } $q->unlock() if $is_locked; } else { - $curproc->log("qmgr: qid=$qid is locked. retry"); + $curproc->logwarn("qmgr: qid=$qid is locked. retry"); } # upper limit of processing done on one process. @@ -149,12 +149,12 @@ sub send } if ($count) { - $curproc->log("qmgr: $count requests processed: ok=$count_ok/$count"); + $curproc->logdebug("qmgr: $count requests processed: ok=$count_ok/$count"); } if ($curproc->is_event_timeout($channel)) { if (defined $queue) { - $curproc->log("qmgr: re-schedule"); + $curproc->logdebug("qmgr: re-schedule"); $queue->reschedule(); } $curproc->set_event_timeout($channel, time + 300); @@ -190,10 +190,10 @@ sub _send }); if ($r) { - $curproc->log("qmgr: qid=$qid status=sent"); + $curproc->logdebug("qmgr: qid=$qid status=sent"); } else { - $curproc->log("qmgr: qid=$qid status=fail"); + $curproc->logerror("qmgr: qid=$qid status=fail"); } return $r; @@ -216,7 +216,7 @@ sub cleanup my ($self) = @_; my $curproc = $self->{ _curproc }; my $queue_dir = $self->{ _directory }; - my $fp = sub { $curproc->log(@_);}; + my $fp = sub { $curproc->logdebug(@_);}; use Mail::Delivery::Queue; my $queue = new Mail::Delivery::Queue { directory => $queue_dir }; @@ -238,7 +238,7 @@ sub cleanup # enough old. if ($mtime < $now - $limit) { - $curproc->log("qmgr: remove too old queue qid=$qid"); + $curproc->logdebug("qmgr: remove too old queue qid=$qid"); $q->remove(); } } diff --git a/fml/lib/FML/Process/State.pm b/fml/lib/FML/Process/State.pm index b1c5152e..c7b43b9d 100644 --- a/fml/lib/FML/Process/State.pm +++ b/fml/lib/FML/Process/State.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: State.pm,v 1.15 2004/08/13 15:02:49 fukachan Exp $ +# $FML: State.pm,v 1.16 2004/09/28 13:37:10 fukachan Exp $ # package FML::Process::State; @@ -95,7 +95,7 @@ sub restriction_state_set_deny_reason my $pcb = $curproc->pcb(); $pcb->set("check_restrictions", "deny_reason", $reason); - $curproc->log("restriction_state_set_deny_reason: $reason") if $debug; + $curproc->logdebug("restriction_state_set_deny_reason: $reason") if $debug; } @@ -122,7 +122,7 @@ sub restriction_state_reply_reason my $rule = $curproc->restriction_state_get_deny_reason(); - $curproc->log("restriction_state_reply_reason: $rule") if $debug; + $curproc->logdebug("restriction_state_reply_reason: $rule") if $debug; if ($rule eq 'reject_system_special_accounts') { my $r = "deny request from a system account"; diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm index ce073d2c..ca3686f7 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.125 2004/11/21 07:00:34 fukachan Exp $ +# $FML: Utils.pm,v 1.126 2004/11/25 12:20:06 fukachan Exp $ # package FML::Process::Utils; @@ -387,7 +387,7 @@ sub _mkpath_str use File::Path; mkpath([ \$dir ], 0, $mode); chmod $mode, \$dir; - \$curproc->log(\"mkdirhier \$dir mode=$mode\"); + \$curproc->log(\"mkdir \$dir mode=$mode\"); }; $curproc->logerror($@) if $@; } diff --git a/fml/lib/FML/Restriction/Command.pm b/fml/lib/FML/Restriction/Command.pm index 3b6aedf3..db3058eb 100644 --- a/fml/lib/FML/Restriction/Command.pm +++ b/fml/lib/FML/Restriction/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.14 2004/03/18 13:29:39 fukachan Exp $ +# $FML: Command.pm,v 1.15 2004/07/23 13:16:43 fukachan Exp $ # package FML::Restriction::Command; @@ -70,7 +70,7 @@ sub permit_user_command else { if ($config->has_attribute('user_command_mail_allowed_commands', $comname)) { - $curproc->log("debug: match: rule=$rule comname=$comname"); + $curproc->logdebug("match: rule=$rule comname=$comname"); return("matched", "permit"); } else { @@ -103,7 +103,7 @@ sub permit_anonymous_command # 2) command match anonymous one ? if ($config->has_attribute('anonymous_command_mail_allowed_commands', $comname)) { - $curproc->log("debug: match: rule=$rule comname=$comname"); + $curproc->logdebug("match: rule=$rule comname=$comname"); return("matched", "permit"); } # XXX-TODO: not need deny reason logging ? @@ -133,7 +133,7 @@ sub permit_admin_member_maps my $match = $cred->is_privileged_member($sender); if ($match) { - $curproc->log("found in admin_member_maps"); + $curproc->logdebug("found in admin_member_maps"); return("matched", "permit"); } # XXX-TODO: not need deny reason logging ? @@ -162,7 +162,7 @@ sub check_admin_member_password } else { # XXX-TODO: not need deny reason logging ? - $curproc->log("admin password: auth fail"); + $curproc->logerror("admin password: auth fail"); return(0, undef); } } diff --git a/fml/lib/FML/Restriction/Post.pm b/fml/lib/FML/Restriction/Post.pm index 00d9ac3a..e7804a5e 100644 --- a/fml/lib/FML/Restriction/Post.pm +++ b/fml/lib/FML/Restriction/Post.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: Post.pm,v 1.14 2004/10/28 03:32:52 fukachan Exp $ +# $FML: Post.pm,v 1.15 2004/11/14 11:18:23 fukachan Exp $ # package FML::Restriction::Post; @@ -181,11 +181,11 @@ sub check_article_thread # if ($match) { - $curproc->log("check_article_thread matched. ($match sec old)"); + $curproc->logdebug("check_article_thread matched. ($match sec old)"); return("matched", "permit"); } else { - $curproc->log("check_article_thread failed."); + $curproc->logdebug("check_article_thread unmatched."); return(0, undef); } } diff --git a/fml/lib/FML/User/Control.pm b/fml/lib/FML/User/Control.pm index f97867d6..ceaf28b4 100644 --- a/fml/lib/FML/User/Control.pm +++ b/fml/lib/FML/User/Control.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: Control.pm,v 1.13 2004/06/27 06:07:12 fukachan Exp $ +# $FML: Control.pm,v 1.14 2004/07/23 13:09:38 fukachan Exp $ # package FML::User::Control; @@ -376,7 +376,7 @@ sub _try_chaddr_in_map $obj->delete( $old_address_in_map ); unless ($obj->error()) { $obj->close(); - $curproc->log("delete $old_address from map=$map"); + $curproc->log("remove $old_address from map=$map"); } else { $curproc->logerror("fail to delete $old_address to map=$map"); |
