README
1NAME
2 Log::Dispatch::ArrayWithLimits - Log to array, with some limits applied
3
4VERSION
5 This document describes version 0.050 of Log::Dispatch::ArrayWithLimits
6 (from Perl distribution Log-Dispatch-ArrayWithLimits), released on
7 2019-01-09.
8
9SYNOPSIS
10 use Log::Dispatch::ArrayWithLimits;
11
12 my $file = Log::Dispatch::ArrayWithLimits(
13 min_level => 'info',
14 array => $ary, # default: [], you can always refer by name e.g. 'My::array' to refer to @My::array
15 max_elems => 100, # defaults unlimited
16 );
17
18 $file->log(level => 'info', message => "Your comment\n");
19
20DESCRIPTION
21 This module functions similarly to Log::Dispatch::Array, with a few
22 differences:
23
24 * only the messages (strings) are stored
25
26 * allow specifying array variable name (e.g. "My::array" instead of
27 \@My:array)
28
29 This makes it possible to use in Log::Log4perl configuration, which
30 is a text file.
31
32 * can apply some limits
33
34 Currently only max_elems (the maximum number of elements in the
35 array) is available. Future limits will be added.
36
37 Logging to an in-process array can be useful when debugging/testing, or
38 when you want to let users of your program connect to your program to
39 request viewing the ogs being produced.
40
41METHODS
42 new(%args)
43 Constructor. This method takes a hash of parameters. The following
44 options are valid: "min_level" and "max_level" (see Log::Dispatch
45 documentation); "array" (a reference to an array, or if value is string,
46 will be taken as name of array variable; this is so this module can be
47 used/configured e.g. by Log::Log4perl because configuration is specified
48 via a text file), "max_elems".
49
50 log_message(message => STR)
51 Send a message to the appropriate output. Generally this shouldn't be
52 called directly but should be called through the "log()" method (in
53 LLog::Dispatch::Output>).
54
55HOMEPAGE
56 Please visit the project's homepage at
57 <https://metacpan.org/release/Log-Dispatch-ArrayWithLimits>.
58
59SOURCE
60 Source repository is at
61 <https://github.com/perlancar/perl-Log-Dispatch-ArrayWithLimits>.
62
63BUGS
64 Please report any bugs or feature requests on the bugtracker website
65 <https://rt.cpan.org/Public/Dist/Display.html?Name=Log-Dispatch-ArrayWit
66 hLimits>
67
68 When submitting a bug or request, please include a test-file or a patch
69 to an existing test-file that illustrates the bug or desired feature.
70
71SEE ALSO
72 Log::Dispatch
73
74 Log::Dispatch::Array
75
76AUTHOR
77 perlancar <perlancar@cpan.org>
78
79COPYRIGHT AND LICENSE
80 This software is copyright (c) 2019, 2014 by perlancar@cpan.org.
81
82 This is free software; you can redistribute it and/or modify it under
83 the same terms as the Perl 5 programming language system itself.
84
85