Write logs in file without buffering
This commit is contained in:
parent
29c9b0e694
commit
885b0f8efb
1 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
|
|
Reference in a new issue