MIME::Tools::ToolkitLogger - a logger which uses Perl's warn()
SYNOPSIS
The MIME::Tools::* modules are for MIME::Tools internal consumption only.
The modules and their interfaces may change radically from version to version.
use MIME::Tools::ToolkitLogger;
### Creation:
$logger = new MIME::Tools::ToolkitLogger;
### Log messages of various types:
$logger->debug("about to open config file");
$logger->warning("missing config file: must create");
$logger->error("unable to create config file");
DESCRIPTION
This is the standard logger used by toolkit modules.
debug() messages
These are printed directly to the STDERR, with a prefix of
"MIME-tools: debug".
Debug message are only logged if you have turned
``debugging'' on in the MIME::Tools configuration.
warning() messages
These are logged by the standard Perl warn() mechanism
to indicate an unusual situation.
They all have a prefix of "MIME-tools: warning".
Warning messages are only logged if $^W is set true
and MIME::Tools is not configured to be ``quiet''.
error() messages
These are logged by the standard Perl warn() mechanism
to indicate that something actually failed.
They all have a prefix of "MIME-tools: error".
Error messages are only logged if $^W is set true
and MIME::Tools is not configured to be ``quiet''.
PUBLIC INTERFACE
new [PREFIX]
Class method, constructor.
Create the logger.
The PREFIX, if given, precedes all messages; it makes it easier
to filter based on the toolkit.
If given, the string should end in colon and space.
The default is ``MIME-tools: ''.
debug MESSAGE...
Instance method, concrete override.
Output a debug message directly to STDERR.
Does nothing if debugging() was set false (the default).
warning MESSAGE...
Instance method, concrete override.
Output a warning message, using Perl's warn().
error MESSAGE...
Instance method, concrete override.
Output an error message, using Perl's warn().
NOTES
All outgoing messages are automatically newline-terminated.
This really could be broken out into two classes: one which
just logs to warn(), and a wrapper which consults MIME::Tools
configuration before doing anything.
SEE ALSO
See MIME::Tools::Logger to learn about our superclass,
and how loggers work.
See MIME::Tools for more information on configuring the
toolkit options which affect this module, particularly
debugging() and quiet().