Acme-Ghost

 view release on metacpan or  search on metacpan

lib/Acme/Ghost/Log.pm  view on Meta::CPAN

package Acme::Ghost::Log;
use strict;
use utf8;

=encoding utf-8

=head1 NAME

Acme::Ghost::Log - Simple logger

=head1 SYNOPSIS

    use Acme::Ghost::Log;

    my $log = Acme::Ghost::Log->new();
       $log->error("My test error message to syslog")

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

    # Customize minimum log level
    my $log = Acme::Ghost::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->warn('This might be a problem');
    $log->error('Garden variety error');
    $log->fatal('Boom');

=head1 DESCRIPTION

Acme::Ghost::Log is a simple logger for Acme::Ghost logging after daemonization

=head2 new

    my $log = Acme::Ghost::Log->new(
        logopt      => 'ndelay,pid',
        facility    => 'user',
        level       => 'debug',
        ident       => 'test.pl',
    );

With default attributes

    use Mojo::Log;
    my $log = Acme::Ghost::Log->new( logger => Mojo::Log->new );
    $log->error("Test error message");

This is example with external loggers

=head1 ATTRIBUTES

This class implements the following attributes

=head2 facility

This attribute sets facility for logging

Available standard facilities: C<auth>, C<authpriv>, C<cron>, C<daemon>, C<ftp>,
C<kern>, C<local0>, C<local1>, C<local2>, C<local3>, C<local4>, C<local5>, C<local6>,
C<local7>, C<lpr>, C<mail>, C<news>, C<syslog>, C<user> and C<uucp>



( run in 0.967 second using v1.01-cache-2.11-cpan-99c4e6809bf )