File: sprintf.t

package info (click to toggle)
liblog-any-perl 1.717-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 448 kB
  • sloc: perl: 1,499; makefile: 11
file content (29 lines) | stat: -rw-r--r-- 665 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use warnings;
use Test::More;
use Log::Any::Test;
use Log::Any::Adapter 'Test';
use Log::Any::Adapter::Util qw(cmp_deeply);

plan tests => 1;

my $log = Log::Any->get_logger();
my @params = ( "args for %s: %s", 'app', [ 'foo', { 'bar' => 5 } ] );
$log->info("not %s", "sprintf");
$log->debugf(@params);
cmp_deeply(
    $log->msgs,
    [
        {
            message     => "not \%s sprintf",
            level    => 'info',
            category => 'main'
        },
        {
            message     => q|args for app: ["foo",{bar => 5}]|,
            level    => 'debug',
            category => 'main'
        }
    ],
    'message was formatted'
);