blib/lib/Venus/Log.pm

filter: Statementstmt 86.3% 76 / 88 Branchbran 67.6% 23 / 34 Conditioncond 59.2% 32 / 54 MC/DCmcdc 15.6% 5 / 32 Subroutinesub 86.9% 20 / 23 Podpod 66.6% 10 / 15 totaltotal 67.4% 166 / 246 CC 36 SCAR 30.7
CC
36
Cov
74%
string
51.8
level_code
6.1
level_name
5.2
CRAP 21.6
« blib/lib/Venus/Mixin.pm ↑ Summary blib/lib/Venus/Module.pm »
1 package Venus::Log;
2  
3 10 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # IMPORTS
9  
10 10 ▶use Venus::Class 'attr', 'base', 'with';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # INHERITS
13  
14 10 base 'Venus::Kind::Utility';
15  
16 # INTEGRATES
17  
18 10 with 'Venus::Role::Buildable';
19  
20 # STATE
21  
22 10 state $NAME = {trace => 1, debug => 2, info => 3, warn => 4, error => 5, fatal => 6};
23 10 state $CODE = {reverse %$NAME};
24  
25 # ATTRIBUTES
26  
27 10 attr 'handler';
28 10 attr 'level';
29 10 attr 'separator';
30  
31 # BUILDERS
32  
33 3 ▶sub build_arg {
Subroutine build_arg: called CC=1 SCAR=0.0
Pod undocumented
34 3 my ($self, $data) = @_;
35  
36 return {
37 3 level => $data,
38 };
39 }
40  
41 143 ▶sub build_self {
Subroutine build_self: called CC=4 SCAR=14.6
Pod undocumented
42 143 my ($self, $data) = @_;
43  
44 143 require Venus::Os;
45  
46 143 ▶ $self->level($self->level_name($self->level) || $self->level_name(1));
Condition66%2/3
$self->level_name($self->level) || $self->level_name(1)
l!l&&r!l&&!r
112310
MC/DC0%0/2
$self->level_name($self->level) || $self->level_name(1)
$self->level_name($self->level) $self->level_name(1)
Truth table66%2/3
A || B
A= $self->level_name($self->level)B= $self->level_name(1)
ABresult
1X1
011
000
47 0 ▶ $self->handler(sub{shift; Venus::Os->new->write('STDOUT', join '', @_, "\n")}) if !$self->handler;
Subroutine __ANON__: not called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
unless $self->handler 33 110 143
48 143 ▶ $self->separator(" ") if !$self->separator;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->separator 143 0 143
49  
50 143 return $self;
51 }
52  
53 # METHODS
54  
55 123 ▶sub commit {
Subroutine commit: called CC=4 SCAR=13.9
Pod undocumented
56 123 my ($self, $level, @args) = @_;
57  
58 123 my $req_level = $self->level_code($level);
59 123 my $set_level = $self->level_code($self->level);
60  
61 123 ▶ return ($req_level && $set_level && ($req_level >= $set_level))
Branch: 1 branch
BranchTrueFalseTotal
$req_level && $set_level && $req_level >= $set_level ? : 117 6 123
Condition83%5/6
$req_level and $set_level and $req_level >= $set_level
!ll&&!rl&&r
15117
$req_level and $set_level
!ll&&!rl&&r
01122
MC/DC66%2/3
$req_level and $set_level and $req_level >= $set_level
$req_level $set_level $req_level >= $set_level
Truth table75%3/4
A and B and C
A= $req_levelB= $set_levelC= $req_level >= $set_level
ABCresult
0XX0
10X0
1100
1111
62 ? $self->write($level, $self->output($self->input(@args)))
63 : $self;
64 }
65  
66 16 ▶sub debug {
Subroutine debug: called CC=1 SCAR=0.0
Pod documented
67 16 my ($self, @args) = @_;
68  
69 16 return $self->commit('debug', @args);
70 }
71  
72 18 ▶sub error {
Subroutine error: called CC=1 SCAR=0.0
Pod documented
73 18 my ($self, @args) = @_;
74  
75 18 return $self->commit('error', @args);
76 }
77  
78 11 ▶sub fatal {
Subroutine fatal: called CC=1 SCAR=0.0
Pod documented
79 11 my ($self, @args) = @_;
80  
81 11 return $self->commit('fatal', @args);
82 }
83  
84 54 ▶sub info {
Subroutine info: called CC=1 SCAR=0.0
Pod documented
85 54 my ($self, @args) = @_;
86  
87 54 return $self->commit('info', @args);
88 }
89  
90 118 ▶sub input {
Subroutine input: called CC=1 SCAR=0.0
Pod documented
91 118 my ($self, @args) = @_;
92  
93 118 return (@args);
94 }
95  
96 246 ▶sub level_code {
Subroutine level_code: called CC=5 SCAR=18.1
Pod undocumented
97 246 my ($self, $data) = @_;
98  
99 246 ▶ $data = $data ? lc $data : $self->level;
Branch: 1 branch
BranchTrueFalseTotal
$data ? : 246 0 246
100  
101 246 ▶ return undef if !defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 246 246
102  
103 246 ▶ return $$NAME{$data} || ($$CODE{$data} && $$NAME{$$CODE{$data}});
Condition50%3/6
$NAME->{$data} || $CODE->{$data} && $$NAME{$CODE->{$data}}
l!l&&r!l&&!r
24501
$CODE->{$data} and $$NAME{$CODE->{$data}}
!ll&&!rl&&r
100
MC/DC33%1/3
$NAME->{$data} || $CODE->{$data} && $$NAME{$CODE->{$data}}
$NAME->{$data} $CODE->{$data} $$NAME{$CODE->{$data}}
Truth table50%2/4
A || B and C
A= $NAME->{$data}B= $CODE->{$data}C= $$NAME{$CODE->{$data}}
ABCresult
1XX1
0111
00X0
0100
104 }
105  
106 174 ▶sub level_name {
Subroutine level_name: called CC=5 SCAR=16.6
Pod undocumented
107 174 my ($self, $data) = @_;
108  
109 174 ▶ $data = $data ? lc $data : $self->level;
Branch: 1 branch
BranchTrueFalseTotal
$data ? : 143 31 174
110  
111 174 ▶ return undef if !defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 31 143 174
112  
113 143 ▶ return $$CODE{$data} || ($$NAME{$data} && $$CODE{$$NAME{$data}});
Condition50%3/6
$CODE->{$data} || $NAME->{$data} && $$CODE{$NAME->{$data}}
l!l&&r!l&&!r
321110
$NAME->{$data} and $$CODE{$NAME->{$data}}
!ll&&!rl&&r
00111
MC/DC0%0/3
$CODE->{$data} || $NAME->{$data} && $$CODE{$NAME->{$data}}
$CODE->{$data} $NAME->{$data} $$CODE{$NAME->{$data}}
Truth table50%2/4
A || B and C
A= $CODE->{$data}B= $NAME->{$data}C= $$CODE{$NAME->{$data}}
ABCresult
1XX1
0111
00X0
0100
114 }
115  
116 123 ▶sub output {
Subroutine output: called CC=1 SCAR=0.0
Pod documented
117 123 my ($self, @args) = @_;
118  
119 123 return (join $self->separator, map $self->string($_), @args);
120 }
121  
122 140 ▶sub string {
Subroutine string: called CC=22 SCAR=39.5
Pod documented
123 140 my ($self, $data) = @_;
124  
125 140 require Scalar::Util;
126  
127 140 ▶ if (!defined $data) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $data) 1 139 140
128 1 return '';
129 }
130  
131 139 my $blessed = Scalar::Util::blessed($data);
132 139 ▶ my $isvenus = $blessed && $data->isa('Venus::Core') && $data->can('does');
Condition50%3/6
$blessed && $data->isa('Venus::Core') && $data->can('does')
!ll&&!rl&&r
13900
$blessed and $data->isa("Venus::Core")
!ll&&!rl&&r
13810
MC/DC0%0/3
$blessed && $data->isa('Venus::Core') && $data->can('does')
$blessed $data->isa("Venus::Core") $data->can('does')
Truth table50%2/4
A and B && C
A= $blessedB= $data->isa("Venus::Core")C= $data->can('does')
ABCresult
0XX0
10X0
1100
1111
133  
134 139 ▶ if (!$blessed && !ref $data) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($blessed or ref $data) 134 5 139
Condition100%3/3
$blessed or ref $data
l!l&&r!l&&!r
14134
MC/DC100%2/2
$blessed or ref $data
$blessed ref $data
Truth table100%3/3
A or B
A= $blessedB= ref $data
ABresult
1X1
011
000
135 134 return $data;
136 }
137 5 ▶ if ($blessed && ref($data) eq 'Regexp') {
Branch: 1 branch
BranchTrueFalseTotal
if ($blessed and ref $data eq "Regexp") 0 5 5
Condition66%2/3
$blessed and ref $data eq "Regexp"
!ll&&!rl&&r
410
MC/DC0%0/2
$blessed and ref $data eq "Regexp"
$blessed ref $data eq "Regexp"
Truth table66%2/3
A and B
A= $blessedB= ref $data eq "Regexp"
ABresult
0X0
100
111
138 0 return "$data";
139 }
140 5 ▶ if ($isvenus && $data->does('Venus::Role::Explainable')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($isvenus and $data->does("Venus::Role::Explainable")) 0 5 5
Condition33%1/3
$isvenus and $data->does("Venus::Role::Explainable")
!ll&&!rl&&r
500
MC/DC0%0/2
$isvenus and $data->does("Venus::Role::Explainable")
$isvenus $data->does("Venus::Role::Explainable")
Truth table33%1/3
A and B
A= $isvenusB= $data->does("Venus::Role::Explainable")
ABresult
0X0
100
111
141 0 ▶ return $self->dump(sub{$data->explain});
Subroutine __ANON__: not called CC=1 SCAR=6.9
142 }
143 5 ▶ if ($isvenus && $data->does('Venus::Role::Valuable')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($isvenus and $data->does("Venus::Role::Valuable")) 0 5 5
Condition33%1/3
$isvenus and $data->does("Venus::Role::Valuable")
!ll&&!rl&&r
500
MC/DC0%0/2
$isvenus and $data->does("Venus::Role::Valuable")
$isvenus $data->does("Venus::Role::Valuable")
Truth table33%1/3
A and B
A= $isvenusB= $data->does("Venus::Role::Valuable")
ABresult
0X0
100
111
144 0 ▶ return $self->dump(sub{$data->value});
Subroutine __ANON__: not called CC=1 SCAR=6.9
145 }
146 5 ▶ if ($isvenus && $data->does('Venus::Role::Dumpable')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($isvenus and $data->does("Venus::Role::Dumpable")) 0 5 5
Condition33%1/3
$isvenus and $data->does("Venus::Role::Dumpable")
!ll&&!rl&&r
500
MC/DC0%0/2
$isvenus and $data->does("Venus::Role::Dumpable")
$isvenus $data->does("Venus::Role::Dumpable")
Truth table33%1/3
A and B
A= $isvenusB= $data->does("Venus::Role::Dumpable")
ABresult
0X0
100
111
147 0 return $data->dump;
148 }
149 5 ▶ if ($blessed && overload::Method($data, '""')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($blessed and overload::Method($data, "\"\"")) 0 5 5
Condition66%2/3
$blessed and overload::Method($data, "\"\"")
!ll&&!rl&&r
410
MC/DC0%0/2
$blessed and overload::Method($data, "\"\"")
$blessed overload::Method($data, "\"\"")
Truth table66%2/3
A and B
A= $blessedB= overload::Method($data, "\"\"")
ABresult
0X0
100
111
150 0 return "$data";
151 }
152 5 ▶ if ($blessed && $data->can('as_string')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($blessed and $data->can("as_string")) 0 5 5
Condition66%2/3
$blessed and $data->can("as_string")
!ll&&!rl&&r
410
MC/DC0%0/2
$blessed and $data->can("as_string")
$blessed $data->can("as_string")
Truth table66%2/3
A and B
A= $blessedB= $data->can("as_string")
ABresult
0X0
100
111
153 0 return $data->as_string;
154 }
155 5 ▶ if ($blessed && $data->can('to_string')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($blessed and $data->can("to_string")) 0 5 5
Condition66%2/3
$blessed and $data->can("to_string")
!ll&&!rl&&r
410
MC/DC0%0/2
$blessed and $data->can("to_string")
$blessed $data->can("to_string")
Truth table66%2/3
A and B
A= $blessedB= $data->can("to_string")
ABresult
0X0
100
111
156 0 return $data->to_string;
157 }
158 5 ▶ if ($blessed && $data->isa('Venus::Kind')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($blessed and $data->isa('Venus::Kind')) { } 0 5 5
Condition66%2/3
$blessed and $data->isa("Venus::Kind")
!ll&&!rl&&r
410
MC/DC0%0/2
$blessed and $data->isa("Venus::Kind")
$blessed $data->isa("Venus::Kind")
Truth table66%2/3
A and B
A= $blessedB= $data->isa("Venus::Kind")
ABresult
0X0
100
111
159 0 return $data->stringified;
160 }
161 else {
162 5 ▶ return $self->dump(sub{$data});
Subroutine __ANON__: called CC=1 SCAR=0.0
163 }
164 }
165  
166 12 ▶sub trace {
Subroutine trace: called CC=1 SCAR=0.0
Pod documented
167 12 my ($self, @args) = @_;
168  
169 12 return $self->commit('trace', @args);
170 }
171  
172 12 ▶sub warn {
Subroutine warn: called CC=1 SCAR=0.0
Pod documented
173 12 my ($self, @args) = @_;
174  
175 12 return $self->commit('warn', @args);
176 }
177  
178 119 ▶sub write {
Subroutine write: called CC=1 SCAR=0.0
Pod documented
179 119 my ($self, $level, @args) = @_;
180  
181 119 $self->handler->($level, @args);
182  
183 119 return $self;
184 }
185  
186 10 1;
187  
188  
189  
190 =head1 NAME
191  
192 Venus::Log - Log Class
193  
194 =cut
195  
196 =head1 ABSTRACT
197  
198 Log Class for Perl 5
199  
200 =cut
201  
202 =head1 SYNOPSIS
203  
204 package main;
205  
206 use Venus::Log;
207  
208 my $log = Venus::Log->new;
209  
210 # $log->trace(time, 'Something failed!');
211  
212 # "0000000000 Something failed!"
213  
214 # $log->error(time, 'Something failed!');
215  
216 # "0000000000 Something failed!"
217  
218 =cut
219  
220 =head1 DESCRIPTION
221  
222 This package provides methods for logging information using various log levels.
223 The default log level is L<trace>. Acceptable log levels are C<trace>,
224 C<debug>, C<info>, C<warn>, C<error>, and C<fatal>, and the set log level will
225 handle events for its level and any preceding levels in the order specified.
226  
227 =cut
228  
229 =head1 ATTRIBUTES
230  
231 This package has the following attributes:
232  
233 =cut
234  
235 =head2 handler
236  
237 handler(coderef $code) (coderef)
238  
239 The handler attribute holds the callback that handles logging. The handler is
240 passed the log level and the log messages.
241  
242 I<Since C<1.68>>
243  
244 =over 4
245  
246 =item handler example 1
247  
248 # given: synopsis
249  
250 package main;
251  
252 my $handler = $log->handler;
253  
254 my $events = [];
255  
256 $handler = $log->handler(sub{shift; push @$events, [@_]});
257  
258 =back
259  
260 =cut
261  
262 =head2 level
263  
264 level(string $name) (string)
265  
266 The level attribute holds the current log level. Valid log levels are C<trace>,
267 C<debug>, C<info>, C<warn>, C<error> and C<fatal>, and will emit log messages
268 in that order. Invalid log levels effectively disable logging.
269  
270 I<Since C<1.68>>
271  
272 =over 4
273  
274 =item level example 1
275  
276 # given: synopsis
277  
278 package main;
279  
280 my $level = $log->level;
281  
282 # "trace"
283  
284 $level = $log->level('fatal');
285  
286 # "fatal"
287  
288 =back
289  
290 =cut
291  
292 =head2 separator
293  
294 separator(any $data) (any)
295  
296 The separator attribute holds the value used to join multiple log message arguments.
297  
298 I<Since C<1.68>>
299  
300 =over 4
301  
302 =item separator example 1
303  
304 # given: synopsis
305  
306 package main;
307  
308 my $separator = $log->separator;
309  
310 # ""
311  
312 $separator = $log->separator("\n");
313  
314 # "\n"
315  
316 =back
317  
318 =cut
319  
320 =head1 INHERITS
321  
322 This package inherits behaviors from:
323  
324 L<Venus::Kind::Utility>
325  
326 =cut
327  
328 =head1 INTEGRATES
329  
330 This package integrates behaviors from:
331  
332 L<Venus::Role::Buildable>
333  
334 =cut
335  
336 =head1 METHODS
337  
338 This package provides the following methods:
339  
340 =cut
341  
342 =head2 debug
343  
344 debug(string @data) (Venus::Log)
345  
346 The debug method logs C<debug> information and returns the invocant.
347  
348 I<Since C<1.68>>
349  
350 =over 4
351  
352 =item debug example 1
353  
354 # given: synopsis
355  
356 package main;
357  
358 # $log = $log->debug(time, 'Something failed!');
359  
360 # "0000000000 Something failed!"
361  
362 =back
363  
364 =over 4
365  
366 =item debug example 2
367  
368 # given: synopsis
369  
370 package main;
371  
372 # $log->level('info');
373  
374 # $log = $log->debug(time, 'Something failed!');
375  
376 # noop
377  
378 =back
379  
380 =cut
381  
382 =head2 error
383  
384 error(string @data) (Venus::Log)
385  
386 The error method logs C<error> information and returns the invocant.
387  
388 I<Since C<1.68>>
389  
390 =over 4
391  
392 =item error example 1
393  
394 # given: synopsis
395  
396 package main;
397  
398 # $log = $log->error(time, 'Something failed!');
399  
400 # "0000000000 Something failed!"
401  
402 =back
403  
404 =over 4
405  
406 =item error example 2
407  
408 # given: synopsis
409  
410 package main;
411  
412 # $log->level('fatal');
413  
414 # $log = $log->error(time, 'Something failed!');
415  
416 # noop
417  
418 =back
419  
420 =cut
421  
422 =head2 fatal
423  
424 fatal(string @data) (Venus::Log)
425  
426 The fatal method logs C<fatal> information and returns the invocant.
427  
428 I<Since C<1.68>>
429  
430 =over 4
431  
432 =item fatal example 1
433  
434 # given: synopsis
435  
436 package main;
437  
438 # $log = $log->fatal(time, 'Something failed!');
439  
440 # "0000000000 Something failed!"
441  
442 =back
443  
444 =over 4
445  
446 =item fatal example 2
447  
448 # given: synopsis
449  
450 package main;
451  
452 # $log->level('unknown');
453  
454 # $log = $log->fatal(time, 'Something failed!');
455  
456 # noop
457  
458 =back
459  
460 =cut
461  
462 =head2 info
463  
464 info(string @data) (Venus::Log)
465  
466 The info method logs C<info> information and returns the invocant.
467  
468 I<Since C<1.68>>
469  
470 =over 4
471  
472 =item info example 1
473  
474 # given: synopsis
475  
476 package main;
477  
478 # $log = $log->info(time, 'Something failed!');
479  
480 # "0000000000 Something failed!"
481  
482 =back
483  
484 =over 4
485  
486 =item info example 2
487  
488 # given: synopsis
489  
490 package main;
491  
492 # $log->level('warn');
493  
494 # $log = $log->info(time, 'Something failed!');
495  
496 # noop
497  
498 =back
499  
500 =cut
501  
502 =head2 input
503  
504 input(string @data) (string)
505  
506 The input method returns the arguments provided to the log level methods, to
507 the L</output>, and can be overridden by subclasses.
508  
509 I<Since C<1.68>>
510  
511 =over 4
512  
513 =item input example 1
514  
515 # given: synopsis
516  
517 package main;
518  
519 my @input = $log->input(1, 'Something failed!');
520  
521 # (1, 'Something failed!')
522  
523 =back
524  
525 =cut
526  
527 =head2 new
528  
529 new(string $level | any %args | hashref $args) (Venus::Log)
530  
531 The new method returns a new instance of this package.
532  
533 I<Since C<1.68>>
534  
535 =over 4
536  
537 =item new example 1
538  
539 package main;
540  
541 use Venus::Log;
542  
543 my $log = Venus::Log->new;
544  
545 # bless(..., "Venus::Log")
546  
547 # $log->level;
548  
549 # "trace"
550  
551 =back
552  
553 =over 4
554  
555 =item new example 2
556  
557 package main;
558  
559 use Venus::Log;
560  
561 my $log = Venus::Log->new('error');
562  
563 # bless(..., "Venus::Log")
564  
565 # $log->level;
566  
567 # "error"
568  
569 =back
570  
571 =over 4
572  
573 =item new example 3
574  
575 package main;
576  
577 use Venus::Log;
578  
579 my $log = Venus::Log->new(5);
580  
581 # bless(..., "Venus::Log")
582  
583 # $log->level;
584  
585 # "error"
586  
587 =back
588  
589 =cut
590  
591 =head2 output
592  
593 output(string @data) (string)
594  
595 The output method returns the arguments returned by the L</input> method, to
596 the log handler, and can be overridden by subclasses.
597  
598 I<Since C<1.68>>
599  
600 =over 4
601  
602 =item output example 1
603  
604 # given: synopsis
605  
606 package main;
607  
608 my $output = $log->output(time, 'Something failed!');
609  
610 # "0000000000 Something failed!"
611  
612 =back
613  
614 =cut
615  
616 =head2 string
617  
618 string(any $data) (string)
619  
620 The string method returns a stringified representation of any argument provided
621 and is used by the L</output> method.
622  
623 I<Since C<1.68>>
624  
625 =over 4
626  
627 =item string example 1
628  
629 # given: synopsis
630  
631 package main;
632  
633 my $string = $log->string;
634  
635 # ""
636  
637 =back
638  
639 =over 4
640  
641 =item string example 2
642  
643 # given: synopsis
644  
645 package main;
646  
647 my $string = $log->string('Something failed!');
648  
649 # "Something failed!"
650  
651 =back
652  
653 =over 4
654  
655 =item string example 3
656  
657 # given: synopsis
658  
659 package main;
660  
661 my $string = $log->string([1,2,3]);
662  
663 # [1,2,3]
664  
665 =back
666  
667 =over 4
668  
669 =item string example 4
670  
671 # given: synopsis
672  
673 package main;
674  
675 my $string = $log->string(bless({}));
676  
677 # "bless({}, 'main')"
678  
679 =back
680  
681 =cut
682  
683 =head2 trace
684  
685 trace(string @data) (Venus::Log)
686  
687 The trace method logs C<trace> information and returns the invocant.
688  
689 I<Since C<1.68>>
690  
691 =over 4
692  
693 =item trace example 1
694  
695 # given: synopsis
696  
697 package main;
698  
699 # $log = $log->trace(time, 'Something failed!');
700  
701 # "0000000000 Something failed!"
702  
703 =back
704  
705 =over 4
706  
707 =item trace example 2
708  
709 # given: synopsis
710  
711 package main;
712  
713 # $log->level('debug');
714  
715 # $log = $log->trace(time, 'Something failed!');
716  
717 # noop
718  
719 =back
720  
721 =cut
722  
723 =head2 warn
724  
725 warn(string @data) (Venus::Log)
726  
727 The warn method logs C<warn> information and returns the invocant.
728  
729 I<Since C<1.68>>
730  
731 =over 4
732  
733 =item warn example 1
734  
735 # given: synopsis
736  
737 package main;
738  
739 # $log = $log->warn(time, 'Something failed!');
740  
741 # "0000000000 Something failed!"
742  
743 =back
744  
745 =over 4
746  
747 =item warn example 2
748  
749 # given: synopsis
750  
751 package main;
752  
753 # $log->level('error');
754  
755 # $log = $log->warn(time, 'Something failed!');
756  
757 # noop
758  
759 =back
760  
761 =cut
762  
763 =head2 write
764  
765 write(string $level, any @data) (Venus::Log)
766  
767 The write method invokes the log handler, i.e. L</handler>, and returns the invocant.
768  
769 I<Since C<1.68>>
770  
771 =over 4
772  
773 =item write example 1
774  
775 # given: synopsis
776  
777 package main;
778  
779 # $log = $log->write('info', time, 'Something failed!');
780  
781 # bless(..., "Venus::Log")
782  
783 =back
784  
785 =cut
786  
787 =head1 AUTHORS
788  
789 Awncorp, C<awncorp@cpan.org>
790  
791 =cut
792  
793 =head1 LICENSE
794  
795 Copyright (C) 2022, Awncorp, C<awncorp@cpan.org>.
796  
797 This program is free software, you can redistribute it and/or modify it under
798 the terms of the Apache license version 2.0.
799  
800 =cut
« blib/lib/Venus/Mixin.pm ↑ Summary blib/lib/Venus/Module.pm »