Catalyst::Action::RenderView::ErrorHandler::Action::Log - A logging action for errors.


Catalyst-Action-RenderView-ErrorHandler documentation Contained in the Catalyst-Action-RenderView-ErrorHandler distribution.

Index


Code Index:

NAME

Top

Catalyst::Action::RenderView::ErrorHandler::Action::Log - A logging action for errors.

VERSION

Top

version 0.100161

SYNOPSIS

Top

    # In a configuration somewhere:
    error_handler:
        actions:
            - type: Log
              id: log-error
              level: error
        handlers:
            fallback:
                actions:
                    - log-error

DESCRIPTION

Top

Really a rather useless example of an ErrorHandler action. It uses catalysts logging facilities to log errors.

INTERFACE

Top

INHERITED ACCESSORS

id

See id in Catalyst::Action::RenderView::ErrorHandler::Action

ACCESSORS

level

The log-level this action uses.

IMPLEMENTED METHODS

perform

Implemented as a requirement of Catalyst::Action::RenderView::ErrorHandler::Action.

Will be called with the $context, and basicly calles $context->log->$level for every error.

INHERITED METHODS

meta

Inherited from Moose.

AUTHOR

Top

Andreas Marienborg <andremar@cpan.org>

COPYRIGHT AND LICENSE

Top


Catalyst-Action-RenderView-ErrorHandler documentation Contained in the Catalyst-Action-RenderView-ErrorHandler distribution.

package Catalyst::Action::RenderView::ErrorHandler::Action::Log;
BEGIN {
  $Catalyst::Action::RenderView::ErrorHandler::Action::Log::VERSION = '0.100161';
}
#ABSTRACT: A logging action for errors.

use strict;
use warnings;
use Moose;

with 'Catalyst::Action::RenderView::ErrorHandler::Action';
has 'level' => (is => 'ro', isa => 'Str', default => 'error');


sub perform {
    my $self = shift;
    my $c = shift;
    
    my $level = $self->level;
    foreach my $e (@{ $c->error }) {
        $c->log->$level($e);
    }
}

1;




__END__