Skip to content

Commit

Permalink
Add headers to every line of multiline log entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mattias-p committed Jan 8, 2021
1 parent b73b77e commit d34f91b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Zonemaster/CLI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,16 @@ sub run {
if ( $self->show_testcase ) {
$prefix .= sprintf "%-14s ", $entry->testcase;
}
$prefix .= $entry->tag;

my $message = $entry->string;
$message =~ s/^([A-Z0-9]+:)*//;
printf "%s%s\n", $prefix, $message;
$message =~ s/^[A-Z0-9:]+//; # strip MODULE:TAG, they're coming in $prefix instead
my @lines = split /\n/, $message;

printf "%s%s %s\n", $prefix, ' ', shift @lines;
for my $line ( @lines ) {
printf "%s%s %s\n", $prefix, '>', $line;
}
}
} ## end if ( $numeric{ uc $entry...})
if ( $self->stop_level and $numeric{ uc $entry->level } >= $numeric{ $self->stop_level } ) {
Expand Down

0 comments on commit d34f91b

Please sign in to comment.