use Try::Tiny;
use System::Introspector::Report::Source;
use System::Introspector::Report::Config;
-use System::Introspector::Report::Logging qw( :log router );
+use System::Introspector::Report::Logging qw( :log router arg_levels);
+use Object::Remote::Logging::Logger;
GetOptions(
's|storage=s' => \my $storage_dir,
'p|publish=s' => \my @publish_types,
'a|all' => \my $all_reports,
'v|verbose+' => \my $log_verbose,
+ 'q|quiet+' => \my $log_quiet,
'h|help' => sub { pod2usage(0) },
) or pod2usage(2);
my $timed = sub { sprintf shift, scalar localtime };
+my $log_level;
+
+if (defined $log_quiet) {
+ $log_level = undef;
+} elsif (! defined $log_verbose) {
+ $log_level = 'info';
+} elsif ($log_verbose == 1) {
+ $log_level = 'verbose';
+} elsif ($log_verbose == 2) {
+ $log_level = 'debug';
+} elsif ($log_verbose == 3) {
+ $log_level = 'trace';
+} else {
+ die "too many -v specified";
+}
+
+if (defined($log_level)) {
+ my $logger = Object::Remote::Logging::Logger->new(
+ min_level => lc($log_level), level_names => arg_levels,
+ format => '%s',
+ );
+
+ router()->connect(sub {
+ return unless $_[1]->{controller} eq 'System::Introspector::Report::Logging';
+ $logger
+ });
+}
+
log_info { 'Starting at %s'->$timed };
my $config = System::Introspector::Report::Config
my @dirs = $self->_find_source_dirs;
for my $dir_spec (@dirs) {
my ($id, $path) = @$dir_spec;
- log_debug { "Starting to load dataset for node '$id' from '$path' " };
my $data = $self->_load_dataset($path, $required)
or next;
log_verbose { "Collecting data from node '$id'" };