diff --git a/ChangeLog.md b/ChangeLog.md index df6f9f0..78f4e3a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -68,9 +68,10 @@ repository history](https://github.com/ddclient/ddclient/commits/master). [#639](https://github.com/ddclient/ddclient/pull/639) * Updated sample systemd service unit file to improve logging in the systemd journal. [#669](https://github.com/ddclient/ddclient/pull/669) - * The second and subsequent lines in a multi-line log message are now prefixed - with a `|` character. + * The second and subsequent lines in a multi-line log message now have a + different prefix to distinguish them from separate log messages. [#676](https://github.com/ddclient/ddclient/pull/676) + [#719](https://github.com/ddclient/ddclient/pull/719) * `emailonly`: New `protocol` option that simply emails you when your IP address changes. [#654](https://github.com/ddclient/ddclient/pull/654) * `he.net`: Added support for updating Hurricane Electric records. diff --git a/ddclient.in b/ddclient.in index 1acbc05..2e93983 100755 --- a/ddclient.in +++ b/ddclient.in @@ -2364,15 +2364,16 @@ sub logmsg { chomp($buffer); my $prefix = $args{pfx}; - $prefix = sprintf "%-9s ", $prefix if $prefix; + $prefix = sprintf "%-8s ", $prefix if $prefix; if ($file) { $prefix .= "file $file"; $prefix .= ", line $lineno" if $lineno; - $prefix .= ": "; + $prefix .= ": "; } if ($prefix) { + $prefix .= "> "; $buffer = "$prefix$buffer"; - $prefix =~ s/ $/| /; + $prefix =~ s/> $/ /; $buffer =~ s/\n/\n$prefix/g; } $buffer .= "\n"; diff --git a/t/logmsg.pl b/t/logmsg.pl index 347a69e..7bd8696 100644 --- a/t/logmsg.pl +++ b/t/logmsg.pl @@ -55,49 +55,49 @@ my @test_cases = ( { desc => 'single-line prefix', args => [pfx => 'PFX:', 'foo'], - want => "PFX: foo\n", + want => "PFX: > foo\n", }, { desc => 'multi-line prefix', args => [pfx => 'PFX:', "foo\nbar"], - want => "PFX: foo\nPFX: | bar\n", + want => "PFX: > foo\nPFX: bar\n", }, { desc => 'single-line long prefix', args => [pfx => 'VERY LONG PREFIX:', 'foo'], - want => "VERY LONG PREFIX: foo\n", + want => "VERY LONG PREFIX: > foo\n", }, { desc => 'multi-line long prefix', args => [pfx => 'VERY LONG PREFIX:', "foo\nbar"], - want => "VERY LONG PREFIX: foo\nVERY LONG PREFIX:| bar\n", + want => "VERY LONG PREFIX: > foo\nVERY LONG PREFIX: bar\n", }, { desc => 'single line, no prefix, file', args => ['foo'], file => 'name', - want => "file name: foo\n", + want => "file name: > foo\n", }, { desc => 'single line, no prefix, file, and line number', args => ['foo'], file => 'name', lineno => 42, - want => "file name, line 42: foo\n", + want => "file name, line 42: > foo\n", }, { desc => 'single line, prefix, file, and line number', args => [pfx => 'PFX:', 'foo'], file => 'name', lineno => 42, - want => "PFX: file name, line 42: foo\n", + want => "PFX: file name, line 42: > foo\n", }, { desc => 'multiple lines, prefix, file, and line number', args => [pfx => 'PFX:', "foo\nbar"], file => 'name', lineno => 42, - want => "PFX: file name, line 42: foo\nPFX: file name, line 42:| bar\n", + want => "PFX: file name, line 42: > foo\nPFX: file name, line 42: bar\n", }, );