| Squatting documentation | view source | Contained in the Squatting distribution. |
Squatting::With::Log - a simple error log for Squatting apps
Adding simple logging to your Squatting app:
use App 'With::Log', 'On::CGI';
This will let log from within your controllers:
C(
Day => [ '/(\d+)/(\d+)/(\d+)' ],
get => sub {
my ($self, $year, $month, $day) = @_;
my $log = $self->log;
$log->debug(" year: $year");
$log->info ("month: $month");
$log->warn (" day: $day");
# you also get $log->error and $log->fatal
$self->render('day');
}
)
Squatting::With::Log provides a simple logging object that can be used from within your controllers to send messages to either a log file or STDERR for informational purposes. Typically, these messages would be useful during development and debugging but would be disabled for production use.
To use this module, pass the string 'With::Log' to the use statement that
loads your Squatting app.
Squatting apps may set the following values in their %CONFIG hash to control
the behavior of this module.
This should be a string that specifies the full path to where you want the logs to be sent.
Example:
$CONFIG{'with.log.path'} = "/tmp/error_log";
This should be a comma-separated string that lists all the log levels you want to enable.
Example: Only output messages with a log level of error or fatal.
$CONFIG{'with.log.levels'} = "error,fatal";
This method enables the list of log levels you send it.
This method disables the list of log levels you send it.
These methods return true if their respective log levels are enabled.
These methods output the list of log messages you send it using the specified log level.
Catalyst::Log - The Squatting::Log API is the same as the Catalyst::Log API.
| Squatting documentation | view source | Contained in the Squatting distribution. |