Fix console logger issue; fixes #5546 (#5547)

This commit is contained in:
Anatoly Galiulin
2017-03-17 02:25:53 +07:00
committed by Andreas Rumpf
parent 9c99973ff8
commit 0874c649e9

View File

@@ -153,8 +153,11 @@ method log*(logger: ConsoleLogger, level: Level, args: varargs[string, `$`]) =
let cln: cstring = ln
{.emit: "console.log(`cln`);".}
else:
writeLine(stdout, ln)
if level in {lvlError, lvlFatal}: flushFile(stdout)
try:
writeLine(stdout, ln)
if level in {lvlError, lvlFatal}: flushFile(stdout)
except IOError:
discard
proc newConsoleLogger*(levelThreshold = lvlAll, fmtStr = defaultFmtStr): ConsoleLogger =
## Creates a new console logger. This logger logs to the console.