NAME
oEdtk::logger - the oEdtk diagnostic logger
SYNOPSIS
use oEdtk::logger;
logger(2, 'a routine message');
logger(-1, 'fatal: cannot open the config file'); # for die()
DESCRIPTION
The single live logger of the toolkit. It writes a formatted diagnostic line (timestamp, level label, PID, message, file handle) to STDERR and returns the line so a caller can reuse it in a die. The contract -- which logger is live, the event-to-level table, and the fd2 routing -- is recorded in docs/integration/LOGGER.md and pinned by t/int/67_logger_normalization.t.
Do not change the exports: the public API is frozen against snap/M.json by t/int/01_api_M.t.
FUNCTIONS
logger
my ($line, $eol) = logger(2, $message, $modify);
Emit a diagnostic line at the given level. The first argument is the level, a number from -1 (fatal) to 8 (user); levels up to 4 always emit (through warn), while higher levels emit only up to the current $LOGGERLEVEL. An optional third argument adjusts $LOGGERLEVEL: an integer delta in 1..4, or one of the letters U D I P W. The message is collapsed to single spaces and its file handle is appended. The formatted line and a newline are returned.
$LOGGERLEVEL
our $LOGGERLEVEL;
The emission ceiling, default 4. Messages above it are suppressed unless the level is raised.
$WARN2LOGGER
our $WARN2LOGGER;
Flag reserved to route warn messages through the logger; off by default.
AUTHOR
The oEdtk team.