/usr/share/perl5/Protocol/ACME/Logger.pm is in libprotocol-acme-perl 1.01-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | package Protocol::ACME::Logger;
use strict;
use warnings;
use Log::Any::Adapter;
use base qw/Log::Any::Adapter::Base/;
use Time::HiRes qw( gettimeofday );
our $VERSION = '1.01';
my %LOG_LEVELS = (
emergency => 0,
alert => 1,
critical => 2,
fatal => 2,
crit => 2,
err => 2,
error => 3,
warn => 4,
warning => 4,
notice => 5,
inform => 6,
info => 6,
debug => 7,
trace => 8,
);
sub init {
my ($self) = @_;
if ( exists $self->{log_level} ) {
$self->{log_level} = $LOG_LEVELS{lc($self->{log_level})}
unless $self->{log_level} =~ /^\d+$/;
}
else {
$self->{log_level} = $LOG_LEVELS{trace};
}
}
foreach my $method (keys %LOG_LEVELS) {
no strict 'refs';
my $method_level = $LOG_LEVELS{$method};
*{$method} = sub {
my ( $self, $text ) = @_;
return if $method_level > $self->{log_level};
my ( $sec, $usec ) = gettimeofday();
printf STDOUT "# %d.%06d %s\n", $sec, $usec, $text;
};
my $detection_method = 'is_' . $method;
*{$detection_method} = sub {
return !!( $method_level <= $_[0]->{log_level} );
};
}
1;
|