/usr/share/perl5/BackupManager/Dialog.pm is in backup-manager 0.7.10.1-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 56 57 58 59 60 61 62 63 64 | package BackupManager::Dialog;
use strict;
use warnings;
use vars qw(@ISA @EXPORT);
@ISA = ('Exporter');
@EXPORT = qw(init_dialog print_info print_warning print_error);
use BackupManager::Logger;
my $dialog_verbose = 0;
sub should_log($) {
my ($level) = @_;
my $level_score = {
debug => 0,
info => 1,
warning => 2,
error => 3,
};
my $conf_level = $ENV{BM_LOGGER_LEVEL} || 'warning';
return $level_score->{$level} >= $level_score->{$conf_level};
}
sub init_dialog($)
{
my ($verbose) = @_;
$dialog_verbose = $verbose if defined $verbose;
}
sub print_info
{
my ($message) = @_;
$message = "" unless defined $message;
chomp $message;
info ($message) if should_log 'info';
print STDOUT $message."\n" if $dialog_verbose;
}
sub print_warning
{
my ($message) = @_;
$message = "" unless defined $message;
chomp $message;
warning ($message) if should_log 'warning';
print STDERR $message."\n" if $dialog_verbose;
}
sub print_error
{
my ($message) = @_;
$message = "" unless defined $message;
chomp $message;
error ($message) if should_log 'error';
print STDERR $message."\n";
}
1;
|