File: 52logdisp.t

package info (click to toggle)
liblog-report-perl 1.40-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 568 kB
  • sloc: perl: 2,905; makefile: 8
file content (46 lines) | stat: -rw-r--r-- 936 bytes parent folder | download | duplicates (6)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env perl
# Test Log::Dispatch (only very simple tests)

use warnings;
use strict;
use lib 'lib', '../lib';

use File::Temp   qw/tempfile/;
use Test::More;

use Log::Report undef, syntax => 'SHORT';

BEGIN
{   eval "require Log::Dispatch";
    plan skip_all => 'Log::Dispatch not installed'
        if $@;

    my $sv = Log::Dispatch->VERSION;
    eval { Log::Dispatch->VERSION(2.00) };
    plan skip_all => "Log::Dispatch too old (is $sv, requires 2.00)"
        if $@;

    plan tests => 5;
    use_ok('Log::Report::Dispatcher::LogDispatch');
}

use_ok('Log::Dispatch::File');

my ($out, $outfn) = tempfile;
dispatcher 'Log::Dispatch::File' => 'logger'
   , filename => $outfn
   , to_level => ['ALERT-' => 'err'];

dispatcher close => 'default';

cmp_ok(-s $outfn, '==', 0);
notice "this is a test";
my $s1 = -s $outfn;
cmp_ok($s1, '>', 0);

warning "some more";
my $s2 = -s $outfn;
cmp_ok($s2, '>', $s1);

unlink $outfn;