Log::Log4perl::Layout::SimpleLayout - Simple Layout


Log-Log4perl documentation Contained in the Log-Log4perl distribution.

Index


Code Index:

NAME

Top

Log::Log4perl::Layout::SimpleLayout - Simple Layout

SYNOPSIS

Top

  use Log::Log4perl::Layout::SimpleLayout;
  my $layout = Log::Log4perl::Layout::SimpleLayout->new();

DESCRIPTION

Top

This class implements the log4j simple layout format -- it basically just prints the message priority and the message, that's all. Check http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/SimpleLayout.html for details.

SEE ALSO

Top

COPYRIGHT AND LICENSE

Top


Log-Log4perl documentation Contained in the Log-Log4perl distribution.

##################################################
package Log::Log4perl::Layout::SimpleLayout;
##################################################
# as documented in
# http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/SimpleLayout.html
##################################################

use 5.006;
use strict;
use warnings;
use Log::Log4perl::Level;

no strict qw(refs);
use base qw(Log::Log4perl::Layout);

##################################################
sub new {
##################################################
    my $class = shift;
    $class = ref ($class) || $class;

    my $self = {
        format      => undef,
        info_needed => {},
        stack       => [],
    };

    bless $self, $class;

    return $self;
}

##################################################
sub render {
##################################################
    my($self, $message, $category, $priority, $caller_level) = @_;

    return "$priority - $message\n";
}

1;

__END__