NAME
Log::ger::Plugin::Multisets - Create multiple sets of logger routines, each set with its own init arguments
VERSION
version 0.005
SYNOPSIS
Instead of having to resort to OO style to log to different categories:
use Log::ger ();
my $access_log = Log::ger->get_logger(category => 'access');
my $error_log = Log::ger->get_logger(category => 'error');
$access_log->info ("goes to access log");
$access_log->warn ("goes to access log");
$error_log ->warn ("goes to error log");
$error_log ->debug("goes to error log");
...
you can instead:
use Log::ger::Plugin Multisets => (
logger_sub_prefixes => {
# prefix => per-target conf
log_ => {category=>'error' }, # or undef, to use the default init args (including category)
access_ => {category=>'access'},
},
level_checker_sub_prefixes => {
# prefix => per-target conf
is_ => {category=>'error' },
access_is_ => {category=>'access'},
},
);
use Log::ger;
log_warn "goes to error log"; # a logger sub for the 'error' category, using the "log_" prefix
log_debug "goes to error log"; # another
access_info "goes to access log"; # a logger sub for the 'access' category, using the "access_" prefix
access_warn "goes to access log"; # another
if (is_debug()) { ... } # a level checker sub for the 'error' category, using the "is_" prefix
if (access_is_trace()) { ... } # a level checker sub for the 'access' category, using the "access_is_" prefix
DESCRIPTION
This plugin lets you create multiple sets of logger subroutines, each set with its own init arguments. This can be used e.g. when you want to log to different categories without resorting to OO style.
CONFIGURATION
logger_sub_prefixes
Hash.
level_checker_sub_prefixes
Hash.
logger_method_prefixes
Hash.
level_checker_method_prefixes
Hash.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2022, 2020 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.