… | |
… | |
278 | |
278 | |
279 | our %LOGGER; |
279 | our %LOGGER; |
280 | |
280 | |
281 | # re-assess logging status for all loggers |
281 | # re-assess logging status for all loggers |
282 | sub _reassess { |
282 | sub _reassess { |
|
|
283 | local $SIG{__DIE__}; |
|
|
284 | my $die = sub { die }; |
|
|
285 | |
283 | for (@_ ? $LOGGER{$_[0]} : values %LOGGER) { |
286 | for (@_ ? $LOGGER{$_[0]} : values %LOGGER) { |
284 | my ($ctx, $level, $renabled) = @$_; |
287 | my ($ctx, $level, $renabled) = @$_; |
285 | |
288 | |
286 | # to detect whether a message would be logged, we # actually |
289 | # to detect whether a message would be logged, we actually |
287 | # try to log one and die. this isn't fast, but we can be |
290 | # try to log one and die. this isn't fast, but we can be |
288 | # sure that the logging decision is correct :) |
291 | # sure that the logging decision is correct :) |
289 | |
292 | |
290 | $$renabled = !eval { |
293 | $$renabled = !eval { |
291 | local $SIG{__DIE__}; |
|
|
292 | |
|
|
293 | _log $ctx, $level, sub { die }; |
294 | _log $ctx, $level, $die; |
294 | |
295 | |
295 | 1 |
296 | 1 |
296 | }; |
297 | }; |
297 | |
|
|
298 | $$renabled = 1; # TODO |
|
|
299 | } |
298 | } |
300 | } |
299 | } |
301 | |
300 | |
302 | sub _logger { |
301 | sub _logger { |
303 | my ($ctx, $level, $renabled) = @_; |
302 | my ($ctx, $level, $renabled) = @_; |