Provided by: libcatalyst-perl_5.90124-1_all bug

NAME

       Catalyst::Log - Catalyst Log Class

SYNOPSIS

           $log = $c->log;
           $log->debug($message);
           $log->info($message);
           $log->warn($message);
           $log->error($message);
           $log->fatal($message);

           if ( $log->is_debug ) {
                # expensive debugging
           }

       See Catalyst.

DESCRIPTION

       This module provides the default, simple logging functionality for Catalyst.  If you want
       something different set "$c->log" in your application module, e.g.:

           $c->log( MyLogger->new );

       Your logging object is expected to provide the interface described here.  Good
       alternatives to consider are Log::Log4Perl and Log::Dispatch.

       If you want to be able to log arbitrary warnings, you can do something along the lines of

           $SIG{__WARN__} = sub { MyApp->log->warn(@_); };

       however this is (a) global, (b) hairy and (c) may have unexpected side effects.  Don't say
       we didn't warn you.

LOG LEVELS

   debug
           $log->is_debug;
           $log->debug($message);

   info
           $log->is_info;
           $log->info($message);

   warn
           $log->is_warn;
           $log->warn($message);

   error
           $log->is_error;
           $log->error($message);

   fatal
           $log->is_fatal;
           $log->fatal($message);

METHODS

   new
       Constructor. Defaults to enable all levels unless levels are provided in arguments.

           $log = Catalyst::Log->new;
           $log = Catalyst::Log->new( 'warn', 'error' );

   level
       Contains a bitmask of the currently set log levels.

   levels
       Set log levels

           $log->levels( 'warn', 'error', 'fatal' );

   enable
       Enable log levels

           $log->enable( 'warn', 'error' );

   disable
       Disable log levels

           $log->disable( 'warn', 'error' );

   is_debug
   is_error
   is_fatal
   is_info
   is_warn
       Is the log level active?

   abort
       Should Catalyst emit logs for this request? Will be reset at the end of each request.

       *NOTE* This method is not compatible with other log apis, so if you plan to use Log4Perl
       or another logger, you should call it like this:

           $c->log->abort(1) if $c->log->can('abort');

   autoflush
       When enabled (default), messages are written to the log immediately instead of queued
       until the end of the request.

       This option, as well as "abort", is provided for modules such as
       Catalyst::Plugin::Static::Simple to be able to programmatically suppress the output of log
       messages. By turning off "autoflush" (application-wide setting) and then setting the
       "abort" flag within a given request, all log messages for the given request will be
       suppressed. "abort" can still be set independently of turning off "autoflush", however. It
       just means any messages sent to the log up until that point in the request will obviously
       still be emitted, since "autoflush" means they are written in real-time.

       If you need to turn off autoflush you should do it like this (in your main app class):

           after setup_finalize => sub {
             my $c = shift;
             $c->log->autoflush(0) if $c->log->can('autoflush');
           };

   _send_to_log
        $log->_send_to_log( @messages );

       This protected method is what actually sends the log information to STDERR.  You may
       subclass this module and override this method to get finer control over the log output.

   psgienv $env
           $log->psgienv($env);

       NOTE: This is not meant for public consumption.

       Set the PSGI environment for this request. This ensures logs will be sent to the right
       place. If the environment has a "psgix.logger", it will be used. If not, we will send logs
       to "psgi.errors" if that exists. As a last fallback, we will send to STDERR as before.

   clear_psgi
       Clears the PSGI environment attributes set by "psgienv".

   meta

SEE ALSO

       Catalyst.

AUTHORS

       Catalyst Contributors, see Catalyst.pm

COPYRIGHT

       This library is free software. You can redistribute it and/or modify it under the same
       terms as Perl itself.