aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Util.pm
diff options
context:
space:
mode:
authorGustavo De Nardin <spuk@mandriva.org>2009-08-06 17:21:03 +0000
committerGustavo De Nardin <spuk@mandriva.org>2009-08-06 17:21:03 +0000
commit8331d2857c2c80963e66c7c1ce25a862ee6e8ace (patch)
tree67abe4b21cb7a715c1a2b810ba4e7b70b27494eb /lib/Iurt/Util.pm
parentf6a182822d3f9711b3dd53ea13b03d9a21fbc631 (diff)
downloadiurt-8331d2857c2c80963e66c7c1ce25a862ee6e8ace.tar
iurt-8331d2857c2c80963e66c7c1ce25a862ee6e8ace.tar.gz
iurt-8331d2857c2c80963e66c7c1ce25a862ee6e8ace.tar.bz2
iurt-8331d2857c2c80963e66c7c1ce25a862ee6e8ace.tar.xz
iurt-8331d2857c2c80963e66c7c1ce25a862ee6e8ace.zip
- don't output control code for back-to-normal color when not using colors
- add an 'ERROR' plog level, as many places use that instead of 'ERR'
Diffstat (limited to 'lib/Iurt/Util.pm')
-rw-r--r--lib/Iurt/Util.pm9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Iurt/Util.pm b/lib/Iurt/Util.pm
index a101f76..3e99154 100644
--- a/lib/Iurt/Util.pm
+++ b/lib/Iurt/Util.pm
@@ -53,8 +53,10 @@ my @plog_prefix = (
"D: ",
);
+# FIXME: remove one of ERROR or ERR, check and fix everywhere else
my %plog_level = (
NONE => 0,
+ ERROR => 1,
ERR => 1,
WARN => 2,
MSG => 3,
@@ -106,16 +108,13 @@ level set with plog_init().
sub plog {
my $level = $#_ ? shift : 'INFO';
$level = $plog_level{$level};
- my ($p, $e) = ($plog_prefix[$level], $plog_ctr{normal});
+ my ($p, $e) = ($plog_prefix[$level], ($plog_color ? $plog_ctr{normal} : ""));
print $plog_file "$p@_$e\n" if $plog_level >= $level;
}
sub pdie {
- my $level = $plog_level{ERROR};
- my ($p, $e) = ($plog_prefix[$level], $plog_ctr{normal});
-
- print $plog_file "$p@_$e\n" if $plog_level >= $level;
+ plog('ERR', "@_");
die $@;
}