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
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.
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.
The module logs following events:
Output of any messages to STDERR (e.g,
print STDERR 'some message')
Messages on STDERR will be logged as
Warnings output (e.g,
warn 'some message')
Warnings will be logged as
Fatal errors output (e.g,
die 'some message')
Fatal messages will be logged as
Log::Any::For::Std redefines descriptor STDERR and signals
__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.
Mikhail Ivanov <email@example.com>
Anastasia Zherebtsova <firstname.lastname@example.org> - 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.