NAME
Piper::Logger - Logging and debugging message handler for Piper
CONSTRUCTOR
new
METHODS
DEBUG($segment, $message, @items)
This method is a no-op unless $self->debug_level($segment) > 0
.
Prints an informational message to STDERR.
Uses the method make_message
to format the printed message according to the debug/verbose levels of $segment
.
Labels the message by pre-pending 'Info: ' to the formatted message.
ERROR($segment, $message, @items)
Prints an error to STDERR and dies via Carp::croak.
Uses the method make_message
to format the printed message according to the debug/verbose levels of $segment
.
Labels the message by pre-pending 'Error: ' to the formatted message.
INFO($segment, $message, @items)
This method is a no-op unless $self->verbose_level($segment) > 0
or $self->debug_level($segment) > 0
.
Prints an informational message to STDERR.
Uses the method make_message
to format the printed message according to the debug/verbose levels of $segment
.
Labels the message by pre-pending 'Info: ' to the formatted message.
WARN($segment, $message, @items)
Prints a warning to STDERR via Carp::carp.
Uses the method make_message
to format the printed message according to the debug/verbose levels of $segment
.
Labels the message by pre-pending 'Warning: ' to the formatted message.
UTILITY METHODS
make_message($segment, $message, @items)
Formats and returns the message according to the debug/verbose levels of $segment
and the provided arguments.
There are two-three parts to the message:
segment_name: message <items>
The message part is simply $message
for all debug/verbose levels.
The <items> part is only included when the verbosity level of the segment is greater than 1. It is formatted by Data::Dump.
If the verbosity and debug levels are both 0, segment_name is simply the segment's label
. If the verbosity level of the segment is greater than zero, the full path of the segment is used instead of label
. If the debug level of the segment is greater than 1, the segment's id
is appended to label
/path
in parentheses.
debug_level($segment)
verbose_level($segment)
These methods determine the appropriate debug and verbosity levels for the given $segment, while respecting any environment variable overrides.
Available environment variable overrides:
PIPER_DEBUG
PIPER_VERBOSE
SEE ALSO
VERSION
version 0.05
AUTHOR
Mary Ehlers <ehlers@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2017 by Mary Ehlers.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004