Log::ger::Plugin::HashArgs - Log using hash arguments
version 0.002
use Log::ger::Plugin 'HashArgs', ( # sub_name => 'log_it', # the default name is 'log' # method_name => 'log_it', # the default name is 'log' # exclusive => 1, # optional, defaults to 0 ); use Log::ger::Output 'Screen'; use Log::ger; log(level => 'info', message => 'an info message ...'); # won't be output to screen log(level => 'warn', message => 'a warning!'); # will be output
To set category:
log(category=>..., level=>..., message=>...);
This is a plugin to log using a single log subroutine that is passed the message as well as the level, using hash arguments.
Note: the multilevel log is slightly slower because of the extra argument and additional string level -> numeric level conversion. See benchmarks in Bencher::Scenarios::LogGer.
Note: the individual separate log_LEVEL subroutines (or LEVEL methods) are still installed, unless you specify configuration "exclusive" to true.
log_LEVEL
LEVEL
Str. Logger subroutine name. Defaults to log if not specified.
log
Str. Logger method name. Defaults to log if not specified.
Boolean. If set to true, will block the generation of the default log_LEVEL subroutines or LEVEL methods (e.g. log_warn, trace, ...).
log_warn
trace
Log::ger::Like::LogDispatch which uses this plugin. The interface provided by this HashArgs plugin is similar to Log::Dispatch interface.
Log::ger::Plugin::MultilevelLog
perlancar <perlancar@cpan.org>
This software is copyright (c) 2020 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.
To install Log::ger::Plugin::HashArgs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::ger::Plugin::HashArgs
CPAN shell
perl -MCPAN -e shell install Log::ger::Plugin::HashArgs
For more information on module installation, please visit the detailed CPAN module installation guide.