Acrux

 view release on metacpan or  search on metacpan

lib/Acrux/Log.pm  view on Meta::CPAN

package Acrux::Log;
use strict;
use utf8;

=encoding utf-8

=head1 NAME

Acrux::Log - Acrux logger

=head1 SYNOPSIS

    use Acrux::Log;

    # Logging to STDERR (by default)
    my $log = Acrux::Log->new();
       $log->error("My test error message to STDERR")

    # Using file
    my $log = Acrux::Log->new(file => '/tmp/test.log');
       $log->error("My test error message to /tmp/test.log")

    # Using STDOUT
    my $log = Acrux::Log->new(file => 'stdout'); # or 'stdout:', ':stdout'
    my $log = Acrux::Log->new(file => '-');

    # Using STDOUT (handle)
    my $log = Acrux::Log->new(
            handle => IO::Handle->new_from_fd(fileno(STDOUT), "w")
        );

    # Using STDERR (default since 0.10)
    my $log = Acrux::Log->new(file => 'stderr'); # or 'stderr:', ':stderr'
    my $log = Acrux::Log->new(file => '=');

    # Using syslog
    my $log = Acrux::Log->new(file => 'syslog'); # or 'syslog:', ':syslog'
    my $log = Acrux::Log->new(file => '@');

    # Customize minimum log level
    my $log = Acrux::Log->new(level => 'warn');

    # Log messages
    $log->trace('Doing stuff');
    $log->debug('Not sure what is happening here');
    $log->info('FYI: it happened again');
    $log->notice('Normal, but significant, condition...');
    $log->warn('This might be a problem');
    $log->error('Garden variety error');
    $log->fatal('Boom');
    $log->crit('Its over...');
    $log->alert('Action must be taken immediately');
    $log->emerg('System is unusable');

=head1 DESCRIPTION

Acrux::Log is a simple logger for Acrux logging

=head2 new

    my $log = Acrux::Log->new(
        logopt      => 'ndelay,pid',
        facility    => 'user',



( run in 0.562 second using v1.01-cache-2.11-cpan-4ab04211f4c )