1NAME
2
3 Log::Log4perl::Tiny - mimic Log::Log4perl in one single module
4
5VERSION
6
7 This document describes Log::Log4perl::Tiny version 1.4.0.
8
9SYNOPSIS
10
11 use Log::Log4perl::Tiny qw( :easy );
12 Log::Log4perl->easy_init({
13 file => '/var/log/something.log',
14 layout => '[%d] [%-5P:%-5p] %m%n',
15 level => $INFO,
16 });
17
18 WARN 'something weird happened';
19 INFO 'just doing it';
20 DEBUG 'this does not get printed at $INFO level';
21
22 # LOGLEVEL isn't in Log::Log4perl, but might come handy
23 LOGLEVEL($DEBUG); # enable debugging for small section
24 # otherwise, "get_logger()->level($DEBUG)", see below
25
26 DEBUG 'now this gets printed';
27 LOGLEVEL($INFO); # disable debugging again
28 DEBUG 'skipped, again';
29 DEBUG 'complex evaluation value:', sub {
30 # evaluation skipped if log level filters DEBUG out
31 };
32
33 # Object-oriented interface is available as well
34 my $logger = get_logger();
35 $logger->level($DEBUG); # enable debugging for small section
36 $logger->debug('whatever you want');
37 $logger->level($INFO); # disable debugging again
38
39 # All stealth loggers are available
40 LOGCONFESS 'I cannot accept this, for a whole stack of reasons!';
41
42 # Want to change layout?
43 $logger->layout('[%d %p] %m%n');
44 # or, equivalently
45 $logger->format('[%d %p] %m%n');
46
47 # Want to send the output somewhere else?
48 use IO::Handle;
49 open my $fh, '>>', '/path/to/new.log';
50 $fh->autoflush();
51 $logger->fh($fh);
52
53 # Want to multiplex output to different channels?
54 $logger->fh(
55 build_channels(
56 fh => \*STDERR,
57 file_create => '/var/log/lastrun.log',
58 file_append => '/var/log/overall.log',
59 )
60 );
61
62 # Want to handle the output message by yourself?
63 my @queue; # e.g. all log messages will be put here
64 $logger->fh(sub { push @queue, $_[0] });
65
66 # As of 1.4.0, you can set key-value pairs in the logger
67 $logger->loglocal(foo => 'bar');
68 LOGLOCAL(baz => 100);
69
70 # You can later retrieve the value in the format with %{key}e
71 $logger->format("[%{foo}e] [%{baz}e] %m%n");
72
73 # You are not limited to scalars, you can use references too
74 LOGLOCAL(baz => sub {
75 my ($data, $op, $ekey) = @_;
76 return join '.', @{$data->{tod}}; # epoch from gettimeofday
77 });
78 LOGLOCAL(foo => sub { return rand 100 });
79
80DESCRIPTION
81
82 Yes... yet another logging module. Nothing particularly fancy nor
83 original, too, but a single-module implementation of the features I use
84 most from Log::Log4perl for quick things, namely:
85
86 * easy mode and stealth loggers (aka log functions INFO, WARN, etc.);
87
88 * debug message filtering by log level;
89
90 * line formatting customisation;
91
92 * quick sending of messages to a log file.
93
94 There are many, many things that are not included; probably the most
95 notable one is the ability to provide a configuration file.
96
97 Why?
98
99 I have really nothing against Log::Log4perl, to the point that one of
100 the import options is to check whether Log::Log4perl is installed and
101 use it if possible. I just needed to crunch the plethora of modules
102 down to a single-file module, so that I can embed it easily in scripts
103 I use in machines where I want to reduce my impact as much as possible.
104
105 Log Levels
106
107 Log::Log4perl::Tiny implements all standard Log::Log4perl's log levels,
108 without the possibility to change them. The correspondent values are
109 available in the following variables (in order of increasing severity
110 or importance):
111
112 $TRACE
113
114 $DEBUG
115
116 $INFO
117
118 $WARN
119
120 $ERROR
121
122 $FATAL
123
124 The default log level is $INFO. In addition to the above, the following
125 levels are defined as well:
126
127 $OFF
128
129 also in Log::Log4perl, useful to turn off all logging except for
130 ALWAYS
131
132 $DEAD
133
134 not in Log::Log4perl, when the threshold log level is set to this
135 value every log is blocked (even when called from the ALWAYS stealth
136 logger).
137
138 You can import these variables using the :levels import facility, or
139 you can use the directly from the Log::Log4perl::Tiny namespace. They
140 are imported automatically if the :easy import option is specified.
141
142 Default Log Level
143
144 As of version 1.1.0 the default logging level is still $INFO like any
145 previous version, but it is possible to modify this value to $DEAD
146 through the :dead_if_first import key.
147
148 This import key is useful to load Log::Log4perl in modules that you
149 want to publish but where you don't want to force the end user to
150 actually use it. In other terms, if you do this:
151
152 package My::Module;
153 use Log::Log4perl::Tiny qw( :easy :dead_if_first );
154
155 you will import all the functionalities associated to :easy but will
156 silence the logger off unless somewhere else the module is loaded (and
157 imported) without this option. In this way:
158
159 * if the user of your module does not import Log::Log4perl::Tiny, all
160 log messages will be dropped (thanks to the log level set to $DEAD)
161
162 * otherwise, if the user imports Log::Log4perl::Tiny without the
163 option, the log level will be set to the default value (unless it has
164 already been explicitly set somewhere else).
165
166 Easy Mode Overview
167
168 I love Log::Log4perl's easy mode because it lets you set up a
169 sophisticated logging infrastructure with just a few keystrokes:
170
171 use Log::Log4perl qw( :easy );
172 Log::Log4perl->easy_init({
173 file => '>>/var/log/something.log',
174 layout => '[%d] [%-5P:%-5p] %m%n',
175 level => $INFO,
176 });
177 INFO 'program started, yay!';
178
179 use Data::Dumper;
180 DEBUG 'Some stuff in main package', sub { Dumper(\%main::) };
181
182 If you want, you can replicate it with just a change in the first line:
183
184 use Log::Log4perl::Tiny qw( :easy );
185 Log::Log4perl->easy_init({
186 file => '>>/var/log/something.log',
187 layout => '[%d] [%-5P:%-5p] %m%n',
188 level => $INFO,
189 });
190 INFO 'program started, yay!';
191
192 use Data::Dumper;
193 DEBUG 'Some stuff in main package', sub { Dumper(\%main::) };
194
195 Well... yes, I'm invading the Log::Log4perl namespace in order to
196 reduce the needed changes as mush as possible. This is useful when I
197 begin using Log::Log4perl and then realise I want to make a single
198 script with all modules embedded. There is also another reason why I
199 put easy_init() in Log::Log4perl namespace:
200
201 use Log::Log4perl::Tiny qw( :full_or_fake :easy );
202 Log::Log4perl->easy_init({
203 file => '>>/var/log/something.log',
204 layout => '[%d] [%-5P:%-5p] %m%n',
205 level => $INFO,
206 });
207 INFO 'program started, yay!';
208
209 use Data::Dumper;
210 DEBUG 'Some stuff in main package', sub { Dumper(\%main::) };
211
212 With import option full_or_fake, in fact, the module first tries to
213 load Log::Log4perl in the caller's namespace with the provided options
214 (except full_or_fake, of course), returning immediately if it is
215 successful; otherwise, it tries to "fake" Log::Log4perl and installs
216 its own logging functions. In this way, if Log::Log4perl is available
217 it will be used, but you don't have to change anything if it isn't.
218
219 Easy mode tries to mimic what Log::Log4perl does, or at least the
220 things that (from a purely subjective point of view) are most useful:
221 easy_init() and stealth loggers.
222
223 easy_init()
224
225 Log::Log4perl::Tiny only supports three options from the big brother:
226
227 level
228
229 the log level threshold. Logs sent at a higher or equal priority
230 (i.e. at a more important level, or equal) will be printed out, the
231 others will be ignored. The default value is $INFO;
232
233 file
234
235 a file name where to send the log lines. For compatibility with
236 Log::Log4perl, a 2-arguments open() will be performed, which means
237 you can easily set the opening mode, e.g. >>filename.
238
239 Note that the 2-arguments open() is intrinsically insecure and will
240 trigger the following error when running setuid:
241
242 Insecure dependency in open while running setuid
243
244 so be sure to use either file_create or file_append instead if you're
245 running setuid. These are extensions added by Log::Log4perl::Tiny to
246 cope with this specific case (and also to allow you avoid the 2-args
247 open() anyway).
248
249 Another Log::Log4perl::Tiny extension added as of version 1.3.0 is
250 the key channels where you can pass an array reference with channels
251 descriptions (see "build_channels" for details).
252
253 The default is to send logging messages to STDERR;
254
255 layout
256
257 the log line layout (it can also be spelled format, they are
258 synonims). The default value is the following:
259
260 [%d] [%5p] %m%n
261
262 which means date in brackets, then log level in brackets always using
263 five chars, left-aligned, the log message and a newline.
264
265 If you call easy_init() with a single unblessed scalar, it is
266 considered to be the level and it will be set accordingly. Otherwise,
267 you have to pass a hash ref with the keys above.
268
269 In addition to the above keys, the easy_init() method installed by
270 Log::Log4perl::Tiny also accepts all keys defined for "new", e.g.
271 format (an alias for layout) and the different alternatives to file
272 (file_insecure, file_create and file_append).
273
274 Stealth Loggers
275
276 Stealth loggers are functions that emit a log message at a given
277 severity; they are installed when :easy mode is turned on (see "Easy
278 Mode Overview").
279
280 They are named after the corresponding level:
281
282 TRACE
283
284 DEBUG
285
286 INFO
287
288 WARN
289
290 ERROR
291
292 FATAL
293
294 Additionally, you get the following logger functions (again, these are
295 in line with Log::Log4perl):
296
297 ALWAYS
298
299 emit log whatever the configured logging level, apart from $DEAD that
300 disables all logging;
301
302 LOGWARN
303
304 emit log at WARN level and then warn() it;
305
306 LOGDIE
307
308 emit log at FATAL level, die() and then exit (if die() didn't already
309 exit);
310
311 LOGEXIT
312
313 emit log at FATAL level and then exit;
314
315 LOGCARP
316
317 emit log at WARN level and then call Carp::carp();
318
319 LOGCLUCK
320
321 emit log at WARN level and then call Carp::cluck();
322
323 LOGCROAK
324
325 emit log at FATAL level and then call Carp::croak();
326
327 LOGCONFESS
328
329 emit log at FATAL level and then call Carp::confess();
330
331 If you want to set the exit code for LOGEXIT above (and LOGDIE as well,
332 in case die() does not exit by itself), you can go "the Log::Log4perl
333 way" and set $Log::Log4perl::LOGEXIT_CODE, or set a code with
334 logexit_code() - but you have to wait to read something about the
335 object-oriented interface before doing this!
336
337 As indicated, functions "LOGWARN", "LOGDIE", "LOGCARP", "LOGCLUCK",
338 "LOGCROACK", and "LOGCONFESS" (as well as their lowercase counterparts
339 called as object methods) both emit the log message on the normal
340 output channel for Log::Log4perl::Tiny and call the respective
341 function. This might not be what you want in the default case where the
342 output channel is standard error, because you will end up with
343 duplicate error messages. You can avoid the call to the canonical
344 function setting import option :no_extra_logdie_message, in line with
345 what Log::Log4perl provides.
346
347 There is also one additional stealth function that Log::Log4perl misses
348 but that I think is of the outmoste importance: LOGLEVEL, to set the
349 log level threshold for printing. If you want to be 100% compatible
350 with Log::Log4perl, anyway, you should rather do the following:
351
352 get_logger()->level(...); # instead of LOGLEVEL(...)
353
354 This function does not get imported when you specify :easy, anyway, so
355 you have to import it explicitly. This will help you remembering that
356 you are deviating from Log::Log4perl.
357
358 Emitting Logs
359
360 To emit a log, you can call any of the stealth logger functions or any
361 of the corresponding log methods. All the parameters that you pass are
362 sent to the output stream as they are, except code references that are
363 first evaluated. This lets you embed costly evaluations (e.g. generate
364 heavy dumps of variabls) inside subroutines, and avoid the cost of
365 evaluation in case the log is filtered out:
366
367 use Data::Dumper;
368 LOGLEVEL($INFO); # cut DEBUG and TRACE out
369 TRACE 'costly evaluation: ', sub { Dumper($heavy_object) };
370 # Dumper() is not actually called because DEBUG level is
371 # filtered out
372
373 If you use the log() method, the first parameter is the log level, then
374 the others are interpreted as described above.
375
376 Log Line Layout
377
378 The log line layout sets the contents of a log line. The layout is
379 configured as a printf-like string, with placeholder identifiers that
380 are modeled (with simplifications) after Log::Log4perl's ones:
381
382 %c Category of the logging event.
383 %C Fully qualified package (or class) name of the caller
384 %d Current date in yyyy/MM/dd hh:mm:ss format
385 %D Current date in strftime's "%Y-%m-%d %H:%M:%S.$u%z" (localtime)
386 %{type}D Current date as strftime's "%Y-%m-%d %H:%M:%S.$u%z"
387 (type can be utc or local)
388 %{key}e Evaluate or substitute (extension WRT Log::Log4perl)
389 %F File where the logging event occurred
390 %H Hostname
391 %l Fully qualified name of the calling method followed by the
392 callers source the file name and line number between
393 parentheses.
394 %L Line number within the file where the log statement was issued
395 %m The message to be logged
396 %M Method or function where the logging request was issued
397 %n Newline (OS-independent)
398 %p Priority of the logging event
399 %P pid of the current process
400 %r Number of milliseconds elapsed from program start to logging
401 event
402 %R Number of milliseconds elapsed from last logging event including
403 a %R to current logging event
404 %T A stack trace of functions called
405 %% A literal percent (%) sign
406
407 Notably, both %x (NDC) and %X (MDC) are missing. The functionality for
408 the latter is partially covered by the extension %e explained below.
409 Moreover, the extended specifier feature with additional info in braces
410 (like %d{HH:mm}) is missing, i.e. the structure of each specifier above
411 is fixed. (Thanks to Log::Tiny for the cool trick of how to handle the
412 printf-like string, which is probably mutuated from Log::Log4perl
413 itself according to the comments).
414
415 There are also two extensions with respect to Log::Log4perl, that help
416 partially cover the missing items explained above, as of release 1.4.0:
417
418 %D
419
420 %{type}D
421
422 expanded to a timestamp according to "strftime" in POSIX specifier
423 %Y-%m-%d %H:%M:%S.$u%z, i.e. a timestamp that includes up to the
424 microsecond (on platform where this is available, otherwise zeros
425 will be used for sub-second values). By default the local time is
426 used, but you can also pass a type specifier set to the string utc,
427 in which case the UTC time will be used (via gmtime).
428
429 %{key}e
430
431 expanded according to what set via "loglocal"/"LOGLOCAL". These two
432 functions allow setting key-value pairs; the key is used to find the
433 associated value, then the value is returned as-is if it's a simple
434 defined scalar, otherwise if it is a sub reference it is invoked,
435 otherwise the empty string is returned.
436
437 In case a subroutine reference is set, it is called with the
438 following parameters:
439
440 $sub->($data, $op, $options);
441
442 where $data is a reference to a hash that contains at least the tod
443 key, associated to an array with the output of gettimeofday (if
444 Time::HiRes is available) or its equivalent (if Time::HiRes is not
445 available), $op is the letter e and $options is the string containing
446 the key in braces (e.g. {this-is-the-key}).
447
448 As of release 1.4.0 all time-expansions in a single log refer to the
449 same time, i.e. if you specify the format string %D %D and you have
450 microsecond-level resolution, the two values in output will be the same
451 (as opposed to show two slightly different times, related to the
452 different expansion times of the %D specifier).
453
454 Wrapping Log::Log4perl::Tiny
455
456 As of release 1.4.0, all expansion sequences that imply using caller
457 (namely %C, %F, %l, %L, %M, and %T) will honor whatever you set for
458 $Log::Log4perl::caller_depth or $Log::Log4perl::Tiny::caller_depth
459 (they're aliased), defaulting to value 0. You can basically increase
460 this value by 1 for each wrapper function that you don't want to appear
461 from the real caller's point of view. In the following example, we have
462 two nested wrappers, each of which takes care to increase the value by
463 1 to be hidden:
464
465 sub my_wrapper_logger {
466 local $Log::Log4perl::Tiny::caller_depth =
467 $Log::Log4perl::Tiny::caller_depth + 1; # ignore my_wrapper_logger
468 INFO(@_);
469 }
470
471 # ... somewhere else...
472 sub wrap_wrapper {
473 local $Log::Log4perl::Tiny::caller_depth =
474 $Log::Log4perl::Tiny::caller_depth + 1; # ignore wrap_wrapper
475 my_wrapper_logger(@_);
476 }
477
478 The control variable is either $Log::Log4perl::Tiny::caller_depth or
479 $Log::Log4perl::caller_depth, as a matter of fact they are aliased
480 (i.e. changing either one will also change the other). This is
481 intentional to let you switch towards Log::Log4perl should you need to
482 upgrade to it.
483
484 See "Using Log::Log4perl with wrapper functions and classes" in
485 Log::Log4perl for further information.
486
487INTERFACE
488
489 You have two interfaces at your disposal, the functional one (with all
490 the stealth logger functions) and the object-oriented one (with
491 explicit actions upon a logger object). Choose your preferred option.
492
493 Functional Interface
494
495 The functional interface sports the following functions (imported
496 automatically when :easy is passed as import option except for
497 LEVELID_FOR, LEVELNAME_FOR and LOGLEVEL):
498
499 TRACE
500
501 DEBUG
502
503 INFO
504
505 WARN
506
507 ERROR
508
509 FATAL
510
511 stealth logger functions, each emits a log at the corresponding
512 level;
513
514 ALWAYS
515
516 emit log whatever the configured logging level (except $DEAD);
517
518 LEVELID_FOR
519
520 returns the identifier related to a certain level. The input level
521 can be either a name or an identifier itself. Returns undef if it is
522 neither.
523
524 It can be used e.g. if you want to use "log" but you only have the
525 level name, not its identifier;
526
527 LEVELNAME_FOR
528
529 returns the name related to a certain level. The input level can be
530 either a name or an identifier itself. Returns undef if it is
531 neither.
532
533 LOGWARN
534
535 emit log at WARN level and then warn() it;
536
537 LOGDIE
538
539 emit log at FATAL level, die() and then exit (if die() didn't already
540 exit);
541
542 LOGEXIT
543
544 emit log at FATAL level and then exit;
545
546 LOGCARP
547
548 emit log at WARN level and then call Carp::carp();
549
550 LOGCLUCK
551
552 emit log at WARN level and then call Carp::cluck();
553
554 LOGCROAK
555
556 emit log at FATAL level and then call Carp::croak();
557
558 LOGCONFESS
559
560 emit log at FATAL level and then call Carp::confess();
561
562 LOGLEVEL
563
564 (Not in Log::Log4perl) (Not imported with :easy)
565
566 set the minimum log level for sending a log message to the output;
567
568 LOGLOCAL
569
570 (Not in Log::Log4perl) (Not imported with :easy) (As of 1.4.0)
571
572 set a key-value pair useful for later expansion via code %{key}e. See
573 "loglocal" below;
574
575 build_channels
576
577 (Not in Log::Log4perl) (Not imported with :easy)
578
579 build multiple channels for emitting logs.
580
581 my $channels = build_channels(@key_value_pairs); # OR
582 my $channels = build_channels(\@key_value_pairs);
583
584 The input is a sequence of key-value pairs, provided either as a list
585 or through a reference to an array containing them. They are not
586 forced into a hash because the same key can appear multiple times to
587 initialize multiple channels.
588
589 The key specifies the type of the channel, while the value is
590 specific to the key:
591
592 fh
593
594 value is a filehandle (or anything that can be passed to the print
595 function)
596
597 sub
598
599 code
600
601 value is a reference to a subroutine. This will be called with two
602 positional parameters: the message (already properly formatted) and
603 a reference to the logger message
604
605 channel
606
607 whatever can be passed to keys fh or to sub/code above
608
609 file
610
611 file_insecure
612
613 file_create
614
615 file_append
616
617 value is the file where log data should be sent.
618
619 The first one is kept for compliance with
620 Log::Log4perl::easy_init's way of accepting a file. It eventually
621 results in a two-arguments open() call, so that you can quickly set
622 how you want to open the file:
623
624 file => '>>/path/to/appended', # append mode
625 file => '>/path/to/new-file', # create mode
626
627 You should avoid doing this, because it is intrinsically insecure
628 and will yield an error message when running setuid:
629
630 Insecure dependency in open while running setuid
631
632 file_insecure is an alias to file, so that you can explicitly
633 signal to the maintainer that you know what you're doing.
634
635 file_create and file_append will use the three-arguments open()
636 call and thus they don't trigger the error above when running
637 setuid. As the respective names suggest the former creates the file
638 from scratch (possibly deleting any previous file with the same
639 path) while the latter opens the file in append mode.
640
641 Object-Oriented Interface
642
643 The functional interface is actually based upon actions on a
644 pre-defined fixed instance of a Log::Log4perl::Tiny object, so you can
645 do the same with a logger object as well:
646
647 get_logger
648
649 this function gives you the pre-defined logger instance (i.e. the
650 same used by the stealth logger functions described above).
651
652 new
653
654 if for obscure reasons the default logger isn't what you want, you
655 can get a brand new object! The constructor accepts either a list of
656 key-values or a reference to a hash, supporting the following keys:
657
658 channels
659
660 set a list (through an array reference) of channels. See
661 "build_channels" for additional information.
662
663 fh
664
665 see method fh below
666
667 file
668
669 file_insecure
670
671 file_create
672
673 file_append
674
675 set the file where the log data will be sent.
676
677 The first one is kept for compliance with
678 Log::Log4perl::easy_init's way of accepting a file. It eventually
679 results in a two-arguments open(), so you might want to take care
680 when running in taint mode.
681
682 See also "build_channels" for additional information. This option
683 takes precedence over fh described below.
684
685 format
686
687 layout
688
689 level
690
691 see easy_init() and the methods below with the same name
692
693 loglocal
694
695 pass a reference to a hash with key-value pairs to be set via
696 "loglocal";
697
698 The methods you can call upon the object mimic the functional
699 interface, but with lowercase method names:
700
701 trace
702
703 debug
704
705 info
706
707 warn
708
709 error
710
711 fatal
712
713 logging functions, each emits a log at the corresponding level;
714
715 is_trace
716
717 is_debug
718
719 is_info
720
721 is_warn
722
723 is_error
724
725 is_fatal
726
727 isTraceEnabled
728
729 isDebugEnabled
730
731 isInfoEnabled
732
733 isWarnEnabled
734
735 isErrorEnabled
736
737 isFatalEnabled
738
739 log level test functions, each returns the status of the
740 corresponding level;
741
742 always
743
744 emit log whatever the configured logging level;
745
746 logwarn
747
748 emit log at WARN level (if allowed) and warn() (always);
749
750 logdie
751
752 emit log at FATAL level, die() and then exit (if die() didn't already
753 exit);
754
755 logexit
756
757 emit log at FATAL level and then exit;
758
759 logcarp
760
761 emit log at WARN level and then call Carp::carp();
762
763 logcluck
764
765 emit log at WARN level and then call Carp::cluck();
766
767 logcroak
768
769 emit log at FATAL level and then call Carp::croak();
770
771 logconfess
772
773 emit log at FATAL level and then call Carp::confess();
774
775 The main logging function is actually the following:
776
777 log
778
779 the first parameter is the log level, the rest is the message to log
780 apart from references to subroutines that are first evaluated
781
782 emit_log
783
784 emit the message in the first positional parameter to all logging
785 channels
786
787 Additionally, you have the following accessors:
788
789 level
790
791 get/set the minimum level for sending messages to the output stream.
792 By default the level is set to $INFO.
793
794 fh
795
796 get/set the output channel.
797
798 As an extention over Log::Log4perl, you can also pass a reference to
799 a subroutine or to an array.
800
801 If you set a reference to a sub, it will be called with two
802 parameters: the message that would be print and a reference to the
803 logger object that is calling the sub. For example, if you simply
804 want to collect the log messages without actually outputting them
805 anywhere, you can do this:
806
807 my @messages;
808 get_logger()->fh(sub {
809 my ($message, $logger) = @_;
810 push @messages, $message;
811 return;
812 });
813
814 If you set a reference to an array, each item inside will be used for
815 log output; its elements can be either filehandles or sub references,
816 used as described above. This is a handy way to set multiple output
817 channels (it might be implemented externally through a proper
818 subroutine reference of course).
819
820 By default this parameter is set to be equal to STDERR.
821
822 format
823
824 layout
825
826 get/set the line formatting;
827
828 logexit_code
829
830 get/set the exit code to be used with logexit() (and logdie() as well
831 if die() doesn't exit).
832
833 loglocal
834
835 get/set a local key-value pair for expansion with %{key}e.
836
837 Always returns the previous value associated to the provided key,
838 removing it:
839
840 my $value = $logger->loglocal('some-key');
841 # now, 'some-key' does not exist any more and has no value associated
842
843 If you pass a value too, it will be set:
844
845 $logger->loglocal(foo => 'bar');
846 my $old = $logger->loglocal(foo => 'whatever');
847 # $old is 'bar'
848 # current value associated to foo is 'whatever'
849
850DEPENDENCIES
851
852 Runs on perl 5.8.0 on with no additional runtime requirements.
853
854 See cpanfile for additional requirements when testing and/or
855 developing. In particular, developing will require Log::Log4perl to
856 perform a comparison between the expansions of a few items related to
857 caller().
858
859BUGS AND LIMITATIONS
860
861 Please view/report any bugs or feature requests through Github at
862 https://github.com/polettix/Log-Log4perl-Tiny/issues.
863
864SEE ALSO
865
866 Log::Log4perl is one of the most useful modules I ever used, go check
867 it!
868
869AUTHOR
870
871 Flavio Poletti <polettix@cpan.org>
872
873COPYRIGHT AND LICENSE
874
875 Copyright (C) 2010-2016 by Flavio Poletti <polettix@cpan.org>.
876
877 This module is free software. You can redistribute it and/or modify it
878 under the terms of the Artistic License 2.0.
879
880 This program is distributed in the hope that it will be useful, but
881 without any warranty; without even the implied warranty of
882 merchantability or fitness for a particular purpose.
883
884