The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Log::Handler::Logger - The main logger class.

SYNOPSIS

    use Log::Handler::Logger;

    my $log = Log::Handler::Logger->new( \%options );

    $log->write($LEVEL, $MESSAGE);

    if ( $log->would_log($LEVEL) ) {
        $log->write($LEVEL, $MESSAGE);
    }

DESCRIPTION

This module is the main logger class.

LOG LEVELS

There are eight log levels and one special level for usage:

    DEBUG, NOTICE, INFO, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY, TRACE

TRACE can be used to write caller informations to the log file so you can see a little history foreach routine that was called. This can be very helpful to determine errors and warnings.

METHODS

new()

Call new() to create a new Log::Handler::Logger object.

The new() method expected the options for the log file. Each option will be set to a default value if not set. If this method is called with no options then it creates an object to log to STDOUT with all default values.

write()

Call write() if you want to log messages to the log file. The log level must be passed in uppercase as first argument. The message will be logged to log file if the log level is active.

Example:

    $log->write('WARNING', 'this message goes to the logfile');

would_log()

This method is very useful if you want to kwow if the current set of minlevel and maxlevel would write the message to the log file. The method returns TRUE if the logger would log it and FALSE if not. Example:

    $log->would_log('DEBUG');

errstr()

This function returns the last error message.

OPTIONS

Please look into the documentation of Log::Handler for more informations.

PREREQUISITES

    Carp
    Devel::Backtrace
    Params::Validate
    POSIX
    Time::HiRes
    Sys::Hostname
    UNIVERSAL::require

EXPORTS

No exports.

REPORT BUGS

Please report all bugs to <jschulz.cpan(at)bloonix.de>.

AUTHOR

Jonny Schulz <jschulz.cpan(at)bloonix.de>.

QUESTIONS

Do you have any questions or ideas?

MAIL: <jschulz.cpan(at)bloonix.de>

If you send me a mail then add Log::Handler into the subject.

COPYRIGHT

Copyright (C) 2007 by Jonny Schulz. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.