/usr/share/perl5/App/Alice/Logger.pm is in alice 0.19-1.
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 | package App::Alice::Logger;
use Any::Moose;
has callbacks => (
is => 'ro',
isa => 'HashRef',
default => sub {
my $hashref = {map {uc $_ => [\&print_line]}
qw/debug info warn error fatal/};
}
);
sub add_cb {
my ($self, $level, $cb) = @_;
return unless $self->callbacks->{$level};
push @{$self->callbacks->{$level}}, $cb;
}
sub log {
my ($self, $level, $message) = @_;
$level = uc $level;
return unless @{$self->callbacks->{$level}};
$_->($level, $message) for @{$self->callbacks->{$level}};
}
sub print_line {
my ($level, $message) = @_;
my ($sec, $min, $hour, $day, $mon, $year) = localtime(time);
my $datestring = sprintf "%02d:%02d:%02d %02d/%02d/%02d",
$hour, $min, $sec, $mon, $day, $year % 100;
print STDERR substr($level, 0, 1) . ", [$datestring] "
. sprintf("% 5s", $level) . " -- : $message\n";
}
__PACKAGE__->meta->make_immutable;
1;
|