From fc555263db7fbb79ab3fe1f15476f72bdb546947 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sun, 6 Dec 2015 10:38:46 +0100 Subject: [PATCH] Pass logger object to the mainsettings hash for a usage inside of the modules. Signed-off-by: Stefan Schantl --- guardian | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); -- 2.39.2