Archived
1
0
Fork 0

Write logs in file without buffering

This commit is contained in:
Mercier Pierre-Olivier 2013-09-15 22:30:27 +02:00
parent 29c9b0e694
commit 885b0f8efb

View file

@ -46,7 +46,9 @@ sub log($@)
say $log_fd strftime("%a %b %e %H:%M:%S %Y", localtime), " START new logging session ";
}
if ($level <= $save_level and $log_fd) {
if ($level <= $save_level and $log_fd)
{
local $| = 1;
print $log_fd strftime("%a %b %e %H:%M:%S %Y", localtime), " ", levelstr($level), " ";
if ($level >= TRACE) {
@ -83,7 +85,8 @@ sub levelstr($)
return "FATAL" if ($level == 1);
return "ERROR" if ($level == 3 or $level == 2);
return "WARN " if ($level == 5 or $level == 4);
return "WARN " if ($level == 4);
return "DONE " if ($level == 5);
return "USAGE" if ($level == 6);
return "INFO " if ($level == 7);
return "DEBUG" if ($level == 8);