1Test::Smoke::LogMixin(3U)ser Contributed Perl DocumentatiToenst::Smoke::LogMixin(3)
2
3
4

NAME

6       Test::Smoke::LogMixin - "Role" that adds logging methods to
7       "traditional" objects.
8

SYNOPSIS

10           package MyPackage;
11           use warnings;
12           use strict;
13           use Test::Smoke::LogMixin;
14
15           sub new {
16               my $class = shift;
17               my %selfish = @_;
18               $selfish{_verbose} ||= 0;
19               return bless \%selfish, $class;
20           }
21           1;
22
23           package main;
24           use MyPackage;
25           my $o = MyPackage->new(_verbose => 2);
26           $o->log_debug("This will end up in the log");
27

DESCRIPTION

29       This package with these mixin-methods acts like a role to extend your
30       traditional (created with "bless()") object with 4 new methods. It has
31       some extra Test::Smoke::App::Base logic to determine the log-level (by
32       looking at "$app->option('verbose')").  For other object types it tries
33       to fiend if there are methods by the name "verbose" or "v", or maybe
34       the keys "_verbose" or "_v" (See also Test::Smoke::ObjectBase).
35
36       The three log methods use the "sprintf()" way of composing strings
37       whenever more than 1 argument is passed!
38
39   $app->verbosity
40       Return the verbosity of this app.
41
42       Arguments
43
44       None.
45
46       Returns
47
48       The value of either "_verbose" or "_v"
49
50   $app->log_warn($fmt, @values)
51       "prinf $fmt, @values" to the currently selected filehandle.
52
53       Arguments
54
55       Positional.
56
57       $fmt => a (s)printf format
58           The format gets an extra new line if one wasn't present.
59
60       @values => optional vaules for the template.
61
62       Returns
63
64       use in void context.
65
66       Exceptions
67
68       None.
69
70   $app->log_info($fmt, @values)
71       "prinf $fmt, @values" to the currently selected filehandle if the
72       'verbose' option is set.
73
74       Arguments
75
76       Positional.
77
78       $fmt => a (s)printf format
79           The format gets an extra new line if one wasn't present.
80
81       @values => optional vaules for the template.
82
83       Returns
84
85       use in void context.
86
87       Exceptions
88
89       None.
90
91   $app->log_debug($fmt, @values)
92       "prinf $fmt, @values" to the currently selected filehandle if the
93       'verbose' option is set to a value > 1.
94
95       Arguments
96
97       Positional.
98
99       $fmt => a (s)printf format
100           The format gets an extra new line if one wasn't present.
101
102       @values => optional vaules for the template.
103
104       Returns
105
106       use in void context.
107
108       Exceptions
109
110       None.
111

NAME

113       Test::Smoke::Logger - Helper object for logging.
114

SYNOPSIS

116           use Test::Smoke::LogMixin;
117           my $logger = Test::Smoke::Logger->new(v => 1);
118           $logger->log_warn("Minimal log level"); # v >= 0
119           $logger->log_info("Medium log level");  # v <= 1
120           $logger->log_debug("High log level");   # v >  1
121

DESCRIPTION

123   Test::Smoke::Logger->new(%arguments)
124       Return a logger instance.
125
126       Arguments
127
128       Named, hash:
129
130       v => <0|1|2>
131
132       Returns
133
134       The Test::Smoke::Logger instance.
135
137       (c) 2020, All rights reserved.
138
139         * Abe Timmerman <abeltje@cpan.org>
140
141       This library is free software; you can redistribute it and/or modify it
142       under the same terms as Perl itself.
143
144       See:
145
146         * <http://www.perl.com/perl/misc/Artistic.html>,
147         * <http://www.gnu.org/copyleft/gpl.html>
148
149       This program is distributed in the hope that it will be useful, but
150       WITHOUT ANY WARRANTY; without even the implied warranty of
151       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
152
153
154
155perl v5.32.0                      2020-07-28          Test::Smoke::LogMixin(3)
Impressum