use System::Introspector::State;
use File::Tree::Snapshot;
use System::Introspector::Config;
-use System::Introspector::Logger qw( :log );
+use System::Introspector::Logger qw(:log);
+use Log::Contextual::Destination;
+use Log::Contextual::SimpleLogger;
+use Object::Remote::Logging qw( );
+
GetOptions(
'c|config=s' => \my $config_file,
die "Requires --all or --group option\n"
unless $update_all or @update_groups;
-#command line arguments override the logging configuration
-#and --log-level overrides -d
+#--log-level overrides -d
if (defined($debug) && ! defined($log_level)) {
- $log_level = 'DEBUG';
+ $log_level = 'debug';
}
-$config_file = "$storage_dir/main.conf" unless defined $config_file;
+my $log_destination;
+if (defined($log_level)) {
+warn "$log_level";
+ $log_destination = Log::Contextual::Destination->new(
+ logger => Log::Contextual::SimpleLogger->new({ levels_upto => $log_level }),
+ );
+
+ $log_destination->connect(System::Introspector::Logger->get_router);
+ #$log_destination->connect(Log::Contextual->get_root_router);
+ #TODO attaching to this router does't work here because of
+ #timming issue
+ #$log_destination->connect(Object::Remote::Logging->get_router);
+}
-my %config_args = (config_file => $config_file);
-$config_args{log_level} = $log_level if defined $log_level;
+$config_file = "$storage_dir/main.conf" unless defined $config_file;
-my $config = System::Introspector::Config->new(%config_args);
+my $config = System::Introspector::Config->new(config_file => $config_file);
$config->has_group($_) or die "Unknown group '$_'\n"
for @update_groups;