logging: Delete unused msg
function
This commit is contained in:
parent
6aa68f72a7
commit
b1752c2622
2 changed files with 6 additions and 5 deletions
|
@ -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'); }
|
||||
|
|
10
t/logmsg.pl
10
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();
|
||||
|
|
Loading…
Reference in a new issue