From b1752c2622948184a1ae1b96900fa3aebff0939f Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 25 Jul 2024 17:42:57 -0400 Subject: [PATCH] logging: Delete unused `msg` function --- ddclient.in | 1 - t/logmsg.pl | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ddclient.in b/ddclient.in index 2e93983..859443a 100755 --- a/ddclient.in +++ b/ddclient.in @@ -2389,7 +2389,6 @@ sub logmsg { } } sub _logmsg_fmt { return (@_ > 1) ? sprintf(shift, @_) : shift; } -sub msg { logmsg( _logmsg_fmt(@_)); } sub verbose { logmsg(email => 1, pfx => shift, _logmsg_fmt(@_)) if opt('verbose'); } sub info { logmsg(email => 1, pfx => 'INFO:', _logmsg_fmt(@_)) if opt('verbose'); } sub debug { logmsg( pfx => 'DEBUG:', _logmsg_fmt(@_)) if opt('debug'); } diff --git a/t/logmsg.pl b/t/logmsg.pl index 7bd8696..f3577a5 100644 --- a/t/logmsg.pl +++ b/t/logmsg.pl @@ -122,18 +122,20 @@ for my $tc (@test_cases) { my $output; open(my $fh, '>', \$output); local *STDERR = $fh; - ddclient::msg('%%'); + local $ddclient::globals{debug} = 1; + ddclient::debug('%%'); close($fh); - is($output, "%%\n", 'single argument is printed directly, not via sprintf'); + is($output, "DEBUG: > %%\n", 'single argument is printed directly, not via sprintf'); } { my $output; open(my $fh, '>', \$output); local *STDERR = $fh; - ddclient::msg('%s', 'foo'); + local $ddclient::globals{debug} = 1; + ddclient::debug('%s', 'foo'); close($fh); - is($output, "foo\n", 'multiple arguments are formatted via sprintf'); + is($output, "DEBUG: > foo\n", 'multiple arguments are formatted via sprintf'); } done_testing();