Piper::Logger - Logging and debugging message handler for Piper
This method is a no-op unless $self->debug_level($segment) > 0.
$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.
make_message
$segment
Labels the message by pre-pending 'Info: ' to the formatted message.
Prints an error to STDERR and dies via Carp::croak.
Labels the message by pre-pending 'Error: ' to the formatted message.
This method is a no-op unless $self->verbose_level($segment) > 0 or $self->debug_level($segment) > 0.
$self->verbose_level($segment) > 0
Prints a warning to STDERR via Carp::carp.
Labels the message by pre-pending 'Warning: ' to the formatted message.
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.
$message
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.
label
id
path
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
version 0.05
Mary Ehlers <ehlers@cpan.org>
This software is Copyright (c) 2017 by Mary Ehlers.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Piper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Piper
CPAN shell
perl -MCPAN -e shell install Piper
For more information on module installation, please visit the detailed CPAN module installation guide.