1Agent::Priorities(3) User Contributed Perl Documentation Agent::Priorities(3)
2
3
4
6 Log::Agent::Priorities - conversion between syslog priorities and
7 levels
8
10 Not intended to be used directly
11
13 This package contains routines to convert between syslog priorities and
14 logging levels: level_from_prio("crit") yields 2, and
15 prio_from_level(4) yields "warning", as does prio_from_level(5).
16
17 Here are the known priorities (which may be abbreviated to the first 2
18 letters, in a case-insensitive manner) and their corresponding logging
19 level:
20
21 Name Level Traditional Export
22 --------- ----- -------------- ------
23 none -1 NONE (special, see text)
24 emergency 0 (emerg, panic) EMERG
25 alert 1 ALERT
26 critical 2 (crit) CRIT
27 error 3 (err) ERROR
28 warning 4 WARN
29 notice 6 NOTICE
30 info 8 INFO
31 debug 10 DEBUG
32
33 The values between parenthesis show the traditional syslog priority
34 tokens. The missing levels (5, 7, 9) are there for possible extension.
35 They currently map to the level immediately below.
36
37 The Export column lists the symbolic constants defined by this package.
38 They can be imported selectively, or alltogether via the ":LEVELS" tag,
39 as in:
40
41 use Log::Agent::Priorities qw(:LEVELS);
42
43 The special token "none" may be used (and spelled out fully) on special
44 occasions: it maps to -1, and is convenient when specifying a logging
45 level, for instance: specifying "none" ensures that no logging will
46 take place, even for emergency situations.
47
48 Anywhere where a priority is expected, one may specify a number taken
49 as a logging level or a string taken as a priority. If the default
50 mapping outlined above is not satisfactory, it can be redefined by
51 specifying, for instance "notice:9". It will be taken as being of level
52 9, but with a "notice" priority nonetheless, not "info" as it would
53 have been implicitely determined otherwise.
54
55 The routine priority_level() decompiles "notice:9" into ("notice", 9),
56 and otherwise uses prio_from_level() or level_from_prio() to compute
57 the missing informatin. For instance, given "critical",
58 priority_level() routine will return the tuple ("critical", 2).
59
61 Raphael Manfredi <Raphael_Manfredi@pobox.com>
62
64 Log::Agent(3), Log::Agent::Logger(3).
65
66
67
68perl v5.32.1 2021-02-15 Agent::Priorities(3)