Name : perl-Log-Any-Adapter-Daemontools
| |
Version : 0.102
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.49
| Date : 2024-08-05 18:59:30
|
Group : Development/Libraries/Perl
| Source RPM : perl-Log-Any-Adapter-Daemontools-0.102-1.49.src.rpm
|
Size : 0.06 MB
| |
Packager : (none)
| |
Summary : Logging adapter suitable for use in a Daemontools-style logging chain
|
Description :
The measure of good software is low learning curve, low complexity, few dependencies, high efficiency, and high flexibility. (choose two. haha)
In the daemontools way of thinking, a daemon writes all its logging output to \'STDOUT\' (or \'STDERR\'), which is a pipe to a logger process. Doing this instead of other logging alternatives keeps your program simple and allows you to capture errors generated by deeper libraries (like libc) which aren\'t aware of your logging API. If you want complicated logging you can keep those details in the logging process and not bloat each daemon you write.
This module aims to be the easiest, simplest, most efficent way to get Log::Any messages to a file handle while still being flexible enough for the needs of the typical unix daemon or utility script.
Problems solved by this module are:
* Preserve log level
The downside of logging to a pipe is you don\'t get the log-level that you could have had with syslog or Log4perl. An simple way to preserve this information is to prefix each line with \"error:\" or etc, which can be re-parsed later (or by the logger process). See format.
* Efficiently squelch log levels
Trace logging is a great thing, but the methods can get a bit \"hot\" and you don\'t want it to impact performance. Log::Any provides the syntax
$log->trace(...) if $log->is_trace
which is great as long as \"is_trace\" is super-efficient. This module does subclassing/caching tricks so that suppressed log levels are effectively \'sub is_trace { 0 }\' (although as of Log::Any 1.03 there is still another layer of method call from the Log::Any::Proxy, which is unfortunate)
* Dynamically adjust log levels
Log::Any::Adapter allows you to replace the current adapters with new ones with a different configuration, which you can use to adjust \'log_level\', but it isn\'t terribly efficient, and if you are also using the regex feature (where different categories get different loggers) it\'s even worse.
This module uses shared configurations on the back-end so you can alter the configuration in many ways without having to re-attach the adapters. (there is a small re-caching penalty, but it\'s done lazily)
* \'--verbose\' / \'--quiet\' / \'$ENV{DEBUG}\'
My scripts usually end up with a chunk of boilerplate in the option processing to raise or lower the log level. This module replaces that with a simple
-init => { argv => \'consume\', env => 1 };
It\'s flexible enough to give you many other common varieties, or you can ignore it because it isn\'t enabled by default.
* Display \'caller\' or \'category\', or custom formatting
And of course, you often want to see additional details about the message or perform some of your own tweaks. This module provides a \'format\' option to easily add \'caller\' info and/or \'category\' where the message originated, and allows full customization with coderefs.
* Enable autoflush on output handle
I often forget to \' $|= 1 \', and then wonder why my log messages don\'t match what the program is currently doing. This module turns on autoflush if \'output\' is a file handle. (but if output is a coderef or other object, it\'s still up to you)
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-L/openSUSE_Tumbleweed/noarch |