From: Stefan Schantl Date: Sun, 6 Dec 2015 09:38:46 +0000 (+0100) Subject: Pass logger object to the mainsettings hash for a usage X-Git-Tag: 2.0~59 X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fguardian.git;a=commitdiff_plain;h=fc555263db7fbb79ab3fe1f15476f72bdb546947 Pass logger object to the mainsettings hash for a usage inside of the modules. Signed-off-by: Stefan Schantl --- diff --git a/guardian b/guardian index f480c11..9245f90 100644 --- a/guardian +++ b/guardian @@ -73,6 +73,10 @@ my %mainsettings = &Guardian::Config::UseConfig($cmdargs{"config"}); my $logger = Guardian::Logger->New(%mainsettings); $logger->Log("debug", "Logger successfully initialized..."); +# Add the logger object to the mainsettings for passing +# it to the modules. +$mainsettings{Logger} = $logger; + # Redirect perls "die" messages to the logger before exiting. $SIG{__DIE__} = sub { $logger->Log("err", "@_"); }; @@ -339,6 +343,12 @@ sub Reload () { # Re-read configuration file. %mainsettings = &Guardian::Config::UseConfig($cmdargs{"config"}); + # Update Logger settings. + $logger = Guardian::Logger->Update(%mainsettings); + + # Update logger object in mainsettings hash. + $mainsettings{Logger} = $logger; + # Re-generate hash of monitored files. %monitored_files = &Guardian::Base::GenerateMonitoredFiles(\%mainsettings, \%monitored_files);