MIME::Tools::PrefixingLogger - wrap a logger in an prefixing mechanism
### 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");
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.
Class method, constructor. Create a new logger around the given backend LOGGER.
Instance method. Push the given PREFIX.
Instance method. Pop the topmost prefix, and return it.
Instance methods, concrete overrides. Prefix the given messages, then use the backend to log them.
To install MIME::Head, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MIME::Head
CPAN shell
perl -MCPAN -e shell install MIME::Head
For more information on module installation, please visit the detailed CPAN module installation guide.