1Log::ger::Format::MultiUlseevrelCLoongt(r3i)buted Perl DLoocgu:m:egnetra:t:iFoonrmat::MultilevelLog(3)
2
3
4

NAME

6       Log::ger::Format::MultilevelLog - Create a log($LEVEL, ...)
7       subroutine/method
8

VERSION

10       version 0.038
11

SYNOPSIS

13       To use for the current package:
14
15        use Log::ger::Format MultilevelLog => (
16            # sub_name => 'log_it',    # optional, defaults to 'log'
17            # method_name => 'log_it', # optional, defaults to 'log'
18            # exclusive => 1,          # optional, defaults to 0
19        );
20        use Log::ger;
21
22        log('warn', 'This is a warning');
23        log('debug', 'This is a debug, data is %s', $data);
24
25        log_warn "This is also a warning"; # still available, unless you set exclusive to 1
26

DESCRIPTION

28       The Log::ger default is to create separate "log_LEVEL" subroutine (or
29       "LEVEL" methods) for each level, e.g. "log_trace" subroutine (or
30       "trace" method), "log_warn" (or "warn"), and so on. But sometimes you
31       might want a log routine that takes $level as the first argument. That
32       is, instead of:
33
34        log_warn('blah ...');
35
36       or:
37
38        $log->debug('Blah: %s', $data);
39
40       you prefer:
41
42        log('warn', 'blah ...');
43
44       or:
45
46        $log->log('debug', 'Blah: %s', $data);
47
48       This format plugin can create such log routine for you.
49
50       Note: the multilevel log is slightly slower because of the extra
51       argument and additional string level -> numeric level conversion. See
52       benchmarks in Bencher::Scenarios::LogGer.
53
54       Note: the individual separate "log_LEVEL" subroutines (or "LEVEL"
55       methods) are still installed, unless you specify configuration
56       "exclusive" to true.
57

CONFIGURATION

59   sub_name
60       String. Defaults to "log".
61
62   method_name
63       String. Defaults to "log".
64
65   exclusive
66       Boolean. If set to true, will block the generation of the default
67       "log_LEVEL" subroutines or "LEVEL" methods (e.g. "log_warn", "trace",
68       ...).
69

SEE ALSO

71       Log::ger::Format::HashArgs
72

AUTHOR

74       perlancar <perlancar@cpan.org>
75
77       This software is copyright (c) 2021, 2020, 2019, 2018, 2017 by
78       perlancar@cpan.org.
79
80       This is free software; you can redistribute it and/or modify it under
81       the same terms as the Perl 5 programming language system itself.
82
83
84
85perl v5.34.0                      2021-07-22Log::ger::Format::MultilevelLog(3)
Impressum