SYNOPSIS
Not intended to be used directly
DESCRIPTION
This package contains routines to convert between syslog priorities and logging levels: level_from_prio(``crit'') yields 2, and prio_from_level(4) yields ``warning'', as does prio_from_level(5).Here are the known priorities (which may be abbreviated to the first 2 letters, in a case-insensitive manner) and their corresponding logging level:
Name Level Traditional Export --------- ----- -------------- ------ none -1 NONE (special, see text) emergency 0 (emerg, panic) EMERG alert 1 ALERT critical 2 (crit) CRIT error 3 (err) ERROR warning 4 WARN notice 6 NOTICE info 8 INFO debug 10 DEBUG
The values between parenthesis show the traditional syslog priority tokens. The missing levels (5, 7, 9) are there for possible extension. They currently map to the level immediately below.
The Export column lists the symbolic constants defined by this package. They can be imported selectively, or alltogether via the ":LEVELS" tag, as in:
use Log::Agent::Priorities qw(:LEVELS);
The special token ``none'' may be used (and spelled out fully) on special occasions: it maps to -1, and is convenient when specifying a logging level, for instance: specifying ``none'' ensures that no logging will take place, even for emergency situations.
Anywhere where a priority is expected, one may specify a number taken as a logging level or a string taken as a priority. If the default mapping outlined above is not satisfactory, it can be redefined by specifying, for instance "notice:9". It will be taken as being of level 9, but with a "notice" priority nonetheless, not "info" as it would have been implicitely determined otherwise.
The routine priority_level() decompiles "notice:9" into (``notice'', 9), and otherwise uses prio_from_level() or level_from_prio() to compute the missing informatin. For instance, given ``critical'', priority_level() routine will return the tuple (``critical'', 2).