Catalyst::Plugin::LogDeep - Sets up L<Log::Deep> for Catalyst logging


Catalyst-Plugin-LogDeep documentation Contained in the Catalyst-Plugin-LogDeep distribution.

Index


Code Index:

NAME

Top

Catalyst::Plugin::LogDeep - Sets up Log::Deep for Catalyst logging

VERSION

Top

This documentation refers to Catalyst::Plugin::LogDeep version 0.0.2.

SYNOPSIS

Top

 use Catalyst qw/ ... LogDeep/;

 __PACKAGE__->config(
     'Plugin::LogDeep' => {
         -name  => __PACKAGE__,
         -level => [ qw/debug warn error fatal/ ],
    },
 );

 $c->log->debug( { var => $variable }, 'This is the value of variable );
 $c->log->error( 'You did not do something' );

DESCRIPTION

Top

Allows Catalyst to use the Log::Deep library for logging operations.

The values set in the Plugin::LogDeep configuration item are passed directly on to the Log::Deep new method so look there for all the options for configuration.

Note: You currently need to tell add a call to $c->log->session in [every] begin method if you want a per session log session id. Hopefully this wont be required in future versions.

SUBROUTINES/METHODS

Top

setup ()

Description: Sets up the catalyst application to use Log::Deep as it's log object.

DIAGNOSTICS

Top

CONFIGURATION AND ENVIRONMENT

Top

DEPENDENCIES

Top

This module has only two dependencies Log::Deep and Catalyst

INCOMPATIBILITIES

Top

BUGS AND LIMITATIONS

Top

There are no known bugs in this module.

Please report problems to Ivan Wills (ivan.wills@gmail.com).

Patches are welcome.

AUTHOR

Top

Ivan Wills (ivan.wills@gmail.com)

LICENSE AND COPYRIGHT

Top


Catalyst-Plugin-LogDeep documentation Contained in the Catalyst-Plugin-LogDeep distribution.

package Catalyst::Plugin::LogDeep;

# Created on: 2009-05-20 04:09:42
# Create by:  Ivan Wills
# $Id$
# $Revision$, $HeadURL$, $Date$
# $Revision$, $Source$, $Date$

use strict;
use warnings;
use version;
use Carp;
use List::Util qw/ first /;
use Log::Deep;
use English qw/ -no_match_vars /;
use base qw/Exporter/;

our $VERSION     = version->new('0.0.2');

my $first = 1;
sub setup {
	my $package = shift;
	my $pkgname = ref $package || $package;

	if ($first) {
		$first = 0;

		do {
			no strict 'refs';  ## no critic
			@{"${pkgname}::ISA"} = grep { $_ ne __PACKAGE__ } @{"${pkgname}::ISA"};
		};

		my $cfg = $package->config->{'Plugin::LogDeep'} || {};

		$package->log( Log::Deep->new( %{ $cfg } ) );
		$package->log->enable('debug');
		$package->log->debug("How do I set the level?");
	}

	$package->NEXT::setup(@_);
};

1;

__END__