NAME
Log::ger::Output::Composite - Composite output
VERSION
version 0.003
SYNOPSIS
use Log::ger::Output Composite => (
outputs => {
# single screen output
Screen => {
level => 'info', # set mper-output level. optional.
conf => { use_color=>1 },
},
# multiple file outputs
File => [
{
conf => { path=>'/var/log/myapp.log' },
level => 'warn',
# set per-category, per-output level. optional.
category_level => {
# don't log myapp.security messages to this file
'myapp.security' => 'off',
},
},
{
conf => { path => '/var/log/myapp-security.log' },
level => 'warn',
category_level => {
# only myapp.security messages go to this file
'myapp.security' => 'warn',
},
},
],
},
# set per-category level. optional.
category_level => {
'category1.sub1' => 'info',
'category2' => 'debug',
...
},
);
use Log::ger;
log_warn "blah...";
DESCRIPTION
This is a Log::ger output that can multiplex output to several outputs and do filtering per-category level, per-output level, or per-output per-category level.
CONFIGURATION
outputs => hash
Specify outputs. It's a hash with output name as keys and output specification as values.
Output name is the name of output module without the Log::ger::Output::
prefix, e.g. Screen or File.
Output specification is either a hashref or arrayref of hashrefs to specify multiple outputs per type (e.g. if you want to output to two File's). Known hashref keys:
conf => hashref
Specify output configuration. See each output documentation for the list of available configuration parameters.
level => str|int|[min, max]
Specify per-output level. If specified, logging will be done at this level instead of the general level. For example, if this is set to
debug
then debug messages and higher will be sent to output even though the general level iswarn
. Vice versa, if this is set toerror
then even though the general level iswarn
, warning messages won't be sent to this output; onlyerror
messages and higher will be sent.You can specify a single level (e.g. 1 or "trace") or a two-element array to specify minimum and maximum level (e.g.
<["trace", "info"]
>). If you accidentally mix up minimum and maximum, this module will helpfully fix it for you.
category_level => hash
TODO
Per-category level has not been implemented.
Per-output per-category level has not been implemented.
ENVIRONMENT
SEE ALSO
Modelled after Log::Any::App.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by 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.