NAME
MIME::Tools::PrefixingLogger - wrap a logger in an prefixing mechanism
SYNOPSIS
### Create the logger:
$backend_logger = ...;
$logger = MIME::Tools::PrefixingLogger->new($backend_logger);
### Change prefix (comments show sample of subsequent logged messages):
$logger->push_prefix("1"); ### 1: message...
$logger->push_prefix("A"); ### 1: A: message...
$logger->pop_prefix; ### 1: message...
$logger->push_prefix("B"); ### 1: B: message...
### Log messages of various types (indents, then relays to backend):
$logger->debug("about to open config file");
$logger->warning("missing config file: must create");
$logger->error("unable to create config file");
DESCRIPTION
Wrap any logger in an object which will automatically indent the given messages before passing them on.
This is useful in Parsing complex MIME entities: the logged messages can be indented based on how deeply they are nested in the entity.
PUBLIC INTERFACE
- new LOGGER
-
Class method, constructor. Create a new logger around the given backend LOGGER.
- push_prefix PREFIX
-
Instance method. Push the given PREFIX.
- pop_prefix
-
Instance method. Pop the topmost prefix, and return it.
- debug MESSAGE...
- warning MESSAGE...
- error MESSAGE...
-
Instance methods, concrete overrides. Prefix the given messages, then use the backend to log them.