line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Log::Clearable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
287418
|
use Mojo::Base 'Mojo::Log'; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
37221
|
use Role::Tiny::With; |
|
1
|
|
|
|
|
299
|
|
|
1
|
|
|
|
|
95
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.001'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Mojo::Log::Role::Clearable'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
1; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Mojo::Log::Clearable - Mojo::Log with clearable log handle |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Mojo::Log::Clearable; |
19
|
|
|
|
|
|
|
my $log = Mojo::Log::Clearable->new(path => $path1); |
20
|
|
|
|
|
|
|
$log->info($message); # Logged to $path1 |
21
|
|
|
|
|
|
|
$log->path($path2); |
22
|
|
|
|
|
|
|
$log->debug($message); # Logged to $path2 |
23
|
|
|
|
|
|
|
$log->path(undef); |
24
|
|
|
|
|
|
|
$log->warn($message); # Logged to STDERR |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Reopen filehandle after logrotate (if logrotate sends SIGUSR1) |
27
|
|
|
|
|
|
|
$SIG{USR1} = sub { $log->clear_handle }; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
L is a subclass of L that applies the |
32
|
|
|
|
|
|
|
L role. See that role's documentation for details. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 AUTHOR |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Dan Book, C |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Copyright 2015, Dan Book. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This library is free software; you may redistribute it and/or modify it undef |
43
|
|
|
|
|
|
|
the terms of the Artistic License version 2.0. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SEE ALSO |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
L, L |