This file is indexed.

/usr/share/perl5/PlSense/Logger.pm is in plsense 0.3.1-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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package PlSense::Logger;

use strict;
use warnings;
use Log::Handler;
use Exporter 'import';
our @EXPORT = qw( logger setup_logger update_logger_level );
{
    my $logger;
    my $logger_alias = "logger";

    sub logger {
        if ( ! $logger ) {
            setup_logger($ENV{PLSENSE_LOG_LEVEL});
        }
        return $logger;
    }

    sub setup_logger {
        my ($level, $filepath) = @_;
        if ( $filepath ) {
            $logger = Log::Handler->new(
                file => { filename => $filepath,
                          utf8 => 1,
                          maxlevel => $level ? $level : "err",
                          timeformat => '%H:%M:%S',
                          message_layout => '%m',
                          message_pattern => [ qw/%T %L %p %l %m/ ],
                          prepare_message => sub {
                              my $m = shift;
                              my $pkgnm = $m->{package};
                              $pkgnm =~ s{ ^PlSense:: }{}xms;
                              $m->{message} = sprintf("%s %-8s %-4s %-45s %s",
                                                      $m->{time}, $m->{level}.":", $$, $pkgnm."(".$m->{line}.")", $m->{message});
                          },
                          alias => $logger_alias,
                      },
                screen => { log_to => "STDERR",
                            maxlevel => "err",
                            message_layout => '%L: %m',
                        },
                );
        }
        else {
            $logger = Log::Handler->new(
                screen => { log_to => "STDERR",
                            maxlevel => $level ? $level : "err",
                            message_layout => '%L: %m',
                        },
                );
        }
    }

    sub update_logger_level {
        my ($level) = @_;
        if ( ! $level ) { return; }
        if ( ! $logger ) { return; }
        $logger->debug("Update log level : $level");
        $logger->set_level( $logger_alias => { maxlevel => $level } );
        return;
    }
}

1;

__END__