diff --git a/src/warden-client/lib/WardenClientCommon.pm b/src/warden-client/lib/WardenClientCommon.pm index 5debf2391df550e1fcc660c893cac912f2900d66..9dcfa645ddd6622736e5c2c735dfa617bdc07626 100755 --- a/src/warden-client/lib/WardenClientCommon.pm +++ b/src/warden-client/lib/WardenClientCommon.pm @@ -17,37 +17,16 @@ use SOAP::Transport::HTTP; our $VERSION = "2.2"; #------------------------------------------------------------------------------- -# warnMsg - prints warning (to STDERR and/or Syslog) and returns 1 -#------------------------------------------------------------------------------- -sub warnMsg -{ - my $msg = shift; - - # print warning to STDERR? - if ($WardenClientConf::LOG_STDERR) { - print STDERR $msg . "\n"; - } - - # print warning to Syslog? - if ($WardenClientConf::LOG_SYSLOG) { - openlog("Warden-client:", "pid", "$WardenClientConf::LOG_SYSLOG_FACILITY"); - syslog("warn|$WardenClientConf::LOG_SYSLOG_FACILITY", $msg . "\n"); - closelog(); - } - - return 1; -} # end of warnMsg() - - -#------------------------------------------------------------------------------- -# errMsg - print error message and returns undef +# errMsg - prints error msg and returns undef or prints warning and returns 1 #------------------------------------------------------------------------------- sub errMsg { my $msg = shift; + my $type = shift; + defined $type or $type = "err"; # default type is err. Other: warn - # is Verbose logging mode enabled? - if ($WardenClientConf::LOG_VERBOSE) { # user wants to log debug information + # is this error report and is Verbose logging mode enabled? + if (($type eq "err") && ($WardenClientConf::LOG_VERBOSE)) { # user wants to log debug information $msg .= "\nStack info: " . Carp::longmess(); } @@ -59,11 +38,16 @@ sub errMsg # log into Syslog? if ($WardenClientConf::LOG_SYSLOG) { openlog("Warden-client:", "pid", "$WardenClientConf::LOG_SYSLOG_FACILITY"); - syslog("err|$WardenClientConf::LOG_SYSLOG_FACILITY", $msg . "\n"); + syslog("$type|$WardenClientConf::LOG_SYSLOG_FACILITY", $msg . "\n"); closelog(); } - return; + if ($type eq 'warn') { # case of 'warn' + return 1; + } else { # case of 'err' + return; + } + } # End of errMsg diff --git a/src/warden-client/lib/WardenClientConf.pm b/src/warden-client/lib/WardenClientConf.pm index 10810606c27e7319646bff5074e6b8bd1d84bb95..6d865bdcd2e25864813eff3b8fa1b6063683302b 100755 --- a/src/warden-client/lib/WardenClientConf.pm +++ b/src/warden-client/lib/WardenClientConf.pm @@ -10,13 +10,6 @@ package WardenClientConf; use strict; -# (for more information se issue #596) - Should be removed in Warden client 3.0 -# Array containg event attributes that has already been reported to user as obsolete. -our %report_obsolete = (); -$report_obsolete{'priority'} = 1; -$report_obsolete{'timeout'} = 1; -# end of issue #596 - # preset of default variables our $URI = undef; our $SSL_KEY_FILE = undef; diff --git a/src/warden-client/lib/WardenClientSend.pm b/src/warden-client/lib/WardenClientSend.pm index 23e57b1b7802cc5b4057fa24f1ecb612658fbeb0..a77b95c1d3f8149dc4e459f42373ef23c2daff39 100755 --- a/src/warden-client/lib/WardenClientSend.pm +++ b/src/warden-client/lib/WardenClientSend.pm @@ -54,21 +54,15 @@ sub saveNewEvent # Checking for obsolete attributes priority or timeout. If not default or 'undef' values are found, print out warning. # check if obsolete event attribute Priority is used - if ($WardenClientConf::report_obsolete{'priority'} && (defined $priority) && ($priority >= 1)) { + if ((defined $priority) && ($priority >= 1)) { # print warning - WardenClientCommon::warnMsg('Event attribute "Priority" is now obsolete and will be removed in Warden client 3.0'); - - # update WardenClientConf::report_obsolete reference to avoid multiple reports regarding one event attribute - $WardenClientConf::report_obsolete{'priority'} = 0; + WardenClientCommon::errMsg('Event attribute "Priority" is now obsolete and will be removed in Warden client 3.0', 'warn'); } # check if obsolete event attribute Timeout is used - if ($WardenClientConf::report_obsolete{'timeout'} && (defined $timeout) && ($timeout >= 0)) { + if ((defined $timeout) && ($timeout >= 0)) { # print warning - WardenClientCommon::warnMsg('Event attribute "Timeout" is now obsolete and will be removed in Warden client 3.0'); - - # update WardenClientConf::report_obsolete reference to avoid multiple reports regarding one event attribute - $WardenClientConf::report_obsolete{'timeout'} = 0; + WardenClientCommon::errMsg('Event attribute "Timeout" is now obsolete and will be removed in Warden client 3.0', 'warn'); } # end of Issue #596