1Log::ger::Plugin::MultiUlseevrelCLoongt(r3i)buted Perl DLoocgu:m:egnetra:t:iPolnugin::MultilevelLog(3)
2
3
4
6 Log::ger::Plugin::MultilevelLog - Create a log($LEVEL, ...)
7 subroutine/method
8
10 version 0.023
11
13 use Log::ger::Plugin MultilevelLog => (
14 sub_name => 'log', # optional
15 method_name => 'log', # optional
16 );
17 use Log::ger;
18
20 The default way is to create separate "log_LEVEL" subroutine (or
21 "LEVEL" methods) for each level, e.g. "log_trace" subroutine (or
22 "trace" method), "log_warn" (or "warn"), and so on. But sometimes you
23 might want a log routine that takes $level as the first argument, e.g.
24 instead of:
25
26 log_warn('blah ...');
27
28 or:
29
30 $log->debug('Blah: %s', $data);
31
32 you prefer:
33
34 log('warn', 'blah ...');
35
36 or:
37
38 $log->log('debug', 'Blah: %s', $data);
39
40 This plugin can create such log routine for you.
41
42 Note: the multilevel log is slower because of extra argument and
43 additional string level -> numeric level conversion.
44
45 Note: the individual separate "log_LEVEL" subroutines (or "LEVEL"
46 methods) are still installed.
47
49 sub_name => str (default: "log")
50 method_name => str (default: "log")
52 perlancar <perlancar@cpan.org>
53
55 This software is copyright (c) 2017 by perlancar@cpan.org.
56
57 This is free software; you can redistribute it and/or modify it under
58 the same terms as the Perl 5 programming language system itself.
59
60
61
62perl v5.28.0 2017-08-03Log::ger::Plugin::MultilevelLog(3)