From b73b77e420127b6be0364eea923d59536f023717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=A4iv=C3=A4rinta?= Date: Fri, 8 Jan 2021 15:47:15 +0100 Subject: [PATCH 1/3] Tiny refactoring Rename variables, update whitespace, remove indirection through sprintf. --- lib/Zonemaster/CLI.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Zonemaster/CLI.pm b/lib/Zonemaster/CLI.pm index 2f026ee2..ce2297a7 100755 --- a/lib/Zonemaster/CLI.pm +++ b/lib/Zonemaster/CLI.pm @@ -437,16 +437,17 @@ sub run { # Don't do anything } else { - my $str = sprintf "%7.2f %-9s ", $entry->timestamp, $entry->level; + my $prefix = sprintf "%7.2f %-9s ", $entry->timestamp, $entry->level; if ( $self->show_module ) { - $str.= sprintf "%-12s ", $entry->module; + $prefix .= sprintf "%-12s ", $entry->module; } if ( $self->show_testcase ) { - $str.= sprintf "%-14s ", $entry->testcase; + $prefix .= sprintf "%-14s ", $entry->testcase; } - my $entry_str = sprintf "%s", $entry->string; - $entry_str =~ s/^([A-Z0-9]+:)*//; - printf "%s%s\n", $str, $entry_str; + + my $message = $entry->string; + $message =~ s/^([A-Z0-9]+:)*//; + printf "%s%s\n", $prefix, $message; } } ## end if ( $numeric{ uc $entry...}) if ( $self->stop_level and $numeric{ uc $entry->level } >= $numeric{ $self->stop_level } ) { From d34f91b522dce95eaf09a9124909ba512bab39f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=A4iv=C3=A4rinta?= Date: Wed, 7 Aug 2019 19:40:22 +0200 Subject: [PATCH 2/3] Add headers to every line of multiline log entries --- lib/Zonemaster/CLI.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Zonemaster/CLI.pm b/lib/Zonemaster/CLI.pm index ce2297a7..082ef2d9 100755 --- a/lib/Zonemaster/CLI.pm +++ b/lib/Zonemaster/CLI.pm @@ -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 } ) { From 9bf1d32f797cab7371d014cf561c5000359ee386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=A4iv=C3=A4rinta?= Date: Fri, 8 Jan 2021 16:36:48 +0100 Subject: [PATCH 3/3] Typo --- lib/Zonemaster/CLI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Zonemaster/CLI.pm b/lib/Zonemaster/CLI.pm index 082ef2d9..55a96545 100755 --- a/lib/Zonemaster/CLI.pm +++ b/lib/Zonemaster/CLI.pm @@ -447,7 +447,7 @@ sub run { $prefix .= $entry->tag; my $message = $entry->string; - $message =~ s/^[A-Z0-9:]+//; # strip MODULE:TAG, they're coming in $prefix instead + $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;