Log::Any::For::Std - Send output of STDERR to Log::Any
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');
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').
$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.
Log::Any::For::Std
use Log::Any::For::Std;
The module logs following events:
Output of any messages to STDERR (e.g, print STDERR 'some message')
print STDERR 'some message'
Messages on STDERR will be logged as $log->notice('some message').
$log->notice('some message')
Warnings output (e.g, warn 'some message')
warn 'some message'
Warnings will be logged as $log->warning('some message').
$log->warning('some message')
Fatal errors output (e.g, die 'some message')
die 'some message'
Fatal messages will be logged as $log->emergency('some message').
$log->emergency('some message')
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.
__WARN__
__DIE__
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.
Log::Any
Mikhail Ivanov <m.ivanych@gmail.com>
Anastasia Zherebtsova <zherebtsova@gmail.com> - translation of documentation into English
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.
To install Log::Any::For::Std, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Any::For::Std
CPAN shell
perl -MCPAN -e shell install Log::Any::For::Std
For more information on module installation, please visit the detailed CPAN module installation guide.