distribution Log-Report-1.24.tar.gz
Mark Overmeer authored 6 years ago
Mark Overmeer committed 6 years ago
5 | 5 |
|
6 | 6 |
TODO:
|
7 | 7 |
. connect to Message::Passing framework
|
|
8 |
|
|
9 |
version 1.24: Fri 8 Dec 09:10:18 CET 2017
|
|
10 |
|
|
11 |
Fixes:
|
|
12 |
- $msg->toString should stringify when append/prepend are objects.
|
|
13 |
rt.cpan.org#123835 [Andy Beverley]
|
|
14 |
|
|
15 |
Improvements:
|
|
16 |
- Log4perl dispatcher: do accept init of Log::Log4perl outside the
|
|
17 |
dispatcher [Abe Timmerman]
|
8 | 18 |
|
9 | 19 |
version 1.23: Thu 2 Nov 10:40:24 CET 2017
|
10 | 20 |
|
|
99 | 109 |
|
100 | 110 |
Fixes:
|
101 | 111 |
- dancer2: regression test only for recent Dancer2 [cpantesters]
|
|
112 |
rt.cpan.org#111770 [Riba Sushi]
|
102 | 113 |
|
103 | 114 |
Improvements:
|
104 | 115 |
- typo rt.cpan.org#111985 [Gregor Herrmann, Debian]
|
1 | 1 |
|
2 | 2 |
use 5.010;
|
3 | 3 |
|
4 | |
my $version = '1.23';
|
|
4 |
my $version = '1.24';
|
5 | 5 |
|
6 | 6 |
my %prereq =
|
7 | 7 |
( Test::More => '0.86'
|
109 | 109 |
=default to_level []
|
110 | 110 |
See M<reasonToLevel()>.
|
111 | 111 |
|
112 | |
=requires config FILENAME|SCALAR
|
|
112 |
=option config FILENAME|SCALAR
|
|
113 |
=default config <undef>
|
113 | 114 |
When a SCALAR reference is passed in, that must refer to a string which
|
114 | 115 |
contains the configuration text. Otherwise, specify an existing FILENAME.
|
115 | 116 |
|
|
117 |
By default, it is expected that M<Log::Log4perl> has been initialized
|
|
118 |
externally. That module uses global variables to communicate, which
|
|
119 |
should be present before any logging is attempted.
|
|
120 |
|
116 | 121 |
=default accept 'ALL'
|
|
122 |
|
117 | 123 |
=cut
|
118 | 124 |
|
119 | 125 |
sub init($)
|
|
122 | 128 |
$self->SUPER::init($args);
|
123 | 129 |
|
124 | 130 |
my $name = $self->name;
|
125 | |
my $config = delete $args->{config}
|
126 | |
or error __x"Log4perl back-end {name} requires a 'config' parameter"
|
127 | |
, name => $name;
|
128 | 131 |
|
129 | 132 |
$self->{LRDL_levels} = { %default_reasonToLevel };
|
130 | 133 |
if(my $to_level = delete $args->{to_level})
|
|
141 | 144 |
}
|
142 | 145 |
}
|
143 | 146 |
|
144 | |
Log::Log4perl->init($config)
|
145 | |
or return;
|
|
147 |
if(my $config = delete $args->{config}) {
|
|
148 |
Log::Log4perl->init($config) or return;
|
|
149 |
}
|
146 | 150 |
|
147 | 151 |
$self;
|
148 | 152 |
}
|
376 | 376 |
my $count = $self->{_count} || 0;
|
377 | 377 |
$locale = $self->{_lang} if $self->{_lang};
|
378 | 378 |
|
|
379 |
my $prepend = $self->{_prepend} // '';
|
|
380 |
my $append = $self->{_append} // '';
|
|
381 |
|
|
382 |
$prepend = "$prepend" if blessed $prepend;
|
|
383 |
$append = "$append" if blessed $append;
|
|
384 |
|
379 | 385 |
$self->{_msgid} # no translation, constant string
|
380 | |
or return (defined $self->{_prepend} ? $self->{_prepend} : '')
|
381 | |
. (defined $self->{_append} ? $self->{_append} : '');
|
|
386 |
or return "$prepend$append";
|
382 | 387 |
|
383 | 388 |
# assumed is that switching locales is expensive
|
384 | 389 |
my $oldloc = setlocale(LC_MESSAGES);
|
|
396 | 401 |
# fill-in the fields
|
397 | 402 |
my $text = $self->{_expand}
|
398 | 403 |
? $domain->interpolate($format, $self)
|
399 | |
: ($self->{_prepend} // '') . $format . ($self->{_append} // '');
|
|
404 |
: "$prepend$format$append";
|
400 | 405 |
|
401 | 406 |
setlocale(LC_MESSAGES, $oldloc)
|
402 | 407 |
if defined $oldloc && (!defined $locale || $oldloc ne $locale);
|
4 | 4 |
use strict;
|
5 | 5 |
use lib 'lib', '../lib';
|
6 | 6 |
|
7 | |
use Test::More tests => 15;
|
|
7 |
use Test::More tests => 16;
|
8 | 8 |
|
9 | 9 |
use Log::Report; # no domains, no translator
|
10 | |
use Scalar::Util qw/refaddr/;
|
|
10 |
use Scalar::Util qw/refaddr blessed/;
|
11 | 11 |
|
12 | 12 |
### examples from Log::Report::Message and more
|
13 | 13 |
|
|
36 | 36 |
my $e = "$h $w\n";
|
37 | 37 |
isa_ok($e, 'Log::Report::Message');
|
38 | 38 |
is("$e", "Hello World!\n");
|
|
39 |
|
|
40 |
### issue #123835
|
|
41 |
|
|
42 |
ok ! blessed(($h.$w)->toString), 'append/prepend must be stringified as well';
|