line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Argon::Log; |
2
|
|
|
|
|
|
|
# ABSTRACT: Simple logging wrapper |
3
|
|
|
|
|
|
|
$Argon::Log::VERSION = '0.17'; |
4
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
65
|
use strict; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
320
|
|
6
|
8
|
|
|
8
|
|
50
|
use warnings; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
247
|
|
7
|
8
|
|
|
8
|
|
46
|
use Carp; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
503
|
|
8
|
8
|
|
|
8
|
|
1422
|
use Time::HiRes 'time'; |
|
8
|
|
|
|
|
5107
|
|
|
8
|
|
|
|
|
292
|
|
9
|
8
|
|
|
8
|
|
5118
|
use AnyEvent::Log; |
|
8
|
|
|
|
|
34214
|
|
|
8
|
|
|
|
|
353
|
|
10
|
|
|
|
|
|
|
|
11
|
8
|
|
|
8
|
|
346
|
use parent 'Exporter'; |
|
8
|
|
|
|
|
254
|
|
|
8
|
|
|
|
|
67
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw( |
14
|
|
|
|
|
|
|
log_level |
15
|
|
|
|
|
|
|
log_trace |
16
|
|
|
|
|
|
|
log_debug |
17
|
|
|
|
|
|
|
log_info |
18
|
|
|
|
|
|
|
log_note |
19
|
|
|
|
|
|
|
log_warn |
20
|
|
|
|
|
|
|
log_error |
21
|
|
|
|
|
|
|
log_fatal |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$Carp::Internal{'Argon::Log'} = 1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub msg { |
27
|
54
|
50
|
|
54
|
0
|
196
|
my $msg = shift or croak 'expected $msg'; |
28
|
54
|
|
|
|
|
190
|
my @args = @_; |
29
|
|
|
|
|
|
|
|
30
|
54
|
|
|
|
|
247
|
foreach my $i (0 .. (@args - 1)) { |
31
|
56
|
50
|
|
|
|
215
|
if (!defined $args[$i]) { |
32
|
0
|
|
|
|
|
0
|
croak sprintf('format parameter %d is uninitialized', $i + 1); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub { |
37
|
0
|
0
|
0
|
0
|
|
0
|
if (@args == 1 && (ref($args[0]) || '') eq 'CODE') { |
|
|
|
0
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
my $val = $args[0]->(); |
39
|
0
|
|
|
|
|
0
|
@args = ($val); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
0
|
sprintf "[%d] $msg", $$, @args; |
43
|
54
|
|
|
|
|
590
|
}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
48
|
|
|
48
|
0
|
180
|
sub log_trace ($;@) { @_ = ('trace', msg(@_)); goto &AE::log } |
|
48
|
|
|
|
|
286
|
|
47
|
5
|
|
|
5
|
0
|
19
|
sub log_debug ($;@) { @_ = ('debug', msg(@_)); goto &AE::log } |
|
5
|
|
|
|
|
29
|
|
48
|
1
|
|
|
1
|
0
|
6
|
sub log_info ($;@) { @_ = ('info' , msg(@_)); goto &AE::log } |
|
1
|
|
|
|
|
8
|
|
49
|
0
|
|
|
0
|
0
|
|
sub log_note ($;@) { @_ = ('note' , msg(@_)); goto &AE::log } |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
0
|
|
sub log_warn ($;@) { @_ = ('warn' , msg(@_)); goto &AE::log } |
|
0
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
0
|
|
sub log_error ($;@) { @_ = ('error', msg(@_)); goto &AE::log } |
|
0
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
0
|
|
sub log_fatal ($;@) { @_ = ('fatal', msg(@_)); goto &AE::log } |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
0
|
|
sub log_level { $AnyEvent::Log::FILTER->level(@_) } |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding UTF-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Argon::Log - Simple logging wrapper |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 VERSION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
version 0.17 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SYNOPSIS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
use Argon::Log; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
log_level 'trace'; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
log_trace 'something happened: %s', $msg; |
79
|
|
|
|
|
|
|
log_debug 'something happened: %s', $msg; |
80
|
|
|
|
|
|
|
log_info 'something happened: %s', $msg; |
81
|
|
|
|
|
|
|
log_note 'something happened: %s', $msg; |
82
|
|
|
|
|
|
|
log_warn 'something happened: %s', $msg; |
83
|
|
|
|
|
|
|
log_error 'something happened: %s', $msg; |
84
|
|
|
|
|
|
|
log_fatal 'something happened: %s', $msg; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 DESCRIPTION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Simple wrapper around AnyEvent::Log. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 AUTHOR |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Jeff Ober <sysread@fastmail.fm> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Jeff Ober. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
99
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |