New log level: DONE
This commit is contained in:
parent
905cc5f2e2
commit
e2f8d2389d
14
ACU/Log.pm
14
ACU/Log.pm
@ -3,6 +3,7 @@ package ACU::Log;
|
||||
use v5.10.1;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Carp;
|
||||
use Data::Dumper;
|
||||
use Exporter 'import';
|
||||
use POSIX qw(strftime);
|
||||
@ -12,15 +13,15 @@ use constant {
|
||||
FATAL => 1,
|
||||
ERROR2 => 2,
|
||||
ERROR => 3,
|
||||
WARN4 => 4,
|
||||
WARN => 5,
|
||||
WARN => 4,
|
||||
DONE => 5,
|
||||
USAGE => 6,
|
||||
INFO => 7,
|
||||
DEBUG => 8,
|
||||
TRACE => 9,
|
||||
};
|
||||
|
||||
our @EXPORT = qw(log FATAL ERROR2 ERROR WARN4 WARN USAGE INFO DEBUG TRACE);
|
||||
our @EXPORT = qw(log FATAL ERROR2 ERROR WARN DONE USAGE INFO DEBUG TRACE);
|
||||
|
||||
our $display_level = 7;
|
||||
our $save_level = 9;
|
||||
@ -35,6 +36,10 @@ sub log($@)
|
||||
my $level = shift;
|
||||
|
||||
if ($#_ < 0) { return; }
|
||||
if (!$_[0]) {
|
||||
$Carp::Verbose = 1;
|
||||
croak "Empty log message, this should not append!";
|
||||
}
|
||||
|
||||
if (!$log_fd && $log_file) {
|
||||
open ($log_fd, ">>", $log_file) or die("Unable to open log ($log_file) file for writing");
|
||||
@ -92,7 +97,8 @@ sub leveldisp($)
|
||||
return BOLD, ON_RED, YELLOW, "/!\\", RESET, " ", BOLD if ($level == 1);
|
||||
return BOLD, ON_RED, ">>>", RESET, " ", BOLD if ($level == 2);
|
||||
return BOLD, RED, ">>>", RESET, " ", BOLD if ($level == 3);
|
||||
return BOLD, YELLOW, ">>>", RESET, " ", BOLD if ($level == 5 or $level == 4);
|
||||
return BOLD, YELLOW, ">>>", RESET, " ", BOLD if ($level == 4);
|
||||
return BOLD, GREEN, ">>>", RESET, " ", BOLD if ($level == 5);
|
||||
return BOLD, MAGENTA, " * ", RESET, " ", BOLD if ($level == 6);
|
||||
return BOLD, CYAN, " * ", RESET, " " if ($level == 7);
|
||||
return BOLD, BLUE, " % ", RESET, " " if ($level == 8);
|
||||
|
Reference in New Issue
Block a user