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

NAME

Log::Any::For::Std - Send output of STDERR to Log::Any

SYNOPSIS

In your application (NOT IN THE MODULE!):

    use Log::Any::Adapter;

    # Capture all the messages sent to STDER
    # and log them through Log::Any
    use Log::Any::For::Std;

    # Send all logs to Log::Any::Adapter::File
    Log::Any::Adapter->set('File', '/path/to/file.log');

DESCRIPTION

Log::Any provides convenient API for logging of messages. But to ensure recording of a message into the log you have to evidently call out one of the logging methods, e.g $log->info('some message').

At the same time it is often needed in programs to log a message which you evidently didn't output. For example it may be a message output by the interpreter STDERR as a result of an error.

The module Log::Any::For::Std logs your messages for you. You can just write in your application use Log::Any::For::Std; and all the standard error messages will start logging magically.

LOGGING EVENTS

The module logs following events:

  • Output of any messages to STDERR (e.g, print STDERR 'some message')

    Messages on STDERR will be logged as $log->notice('some message').

  • Warnings output (e.g, warn 'some message')

    Warnings will be logged as $log->warning('some message').

  • Fatal errors output (e.g, die 'some message')

    Fatal messages will be logged as $log->emergency('some message').

ATTENTION

Module Log::Any::For::Std redefines descriptor STDERR and signals __WARN__ and __DIE__. These are global variables. Their action applies to the whole program. In case your program defines these signals too you cannot use this module.

It means as well that you should not use this module inside other modules. Use it only in executable script, otherwise hardly detected errors may emerge.

Later on I'll try to do something with it. Sorry.

SEE ALSO

Log::Any

AUTHORS

  • Mikhail Ivanov <m.ivanych@gmail.com>

  • Anastasia Zherebtsova <zherebtsova@gmail.com> - translation of documentation into English

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Mikhail Ivanov.

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