summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnatoly Galiulin <galiulin.anatoly@gmail.com>2017-03-17 02:25:53 +0700
committerAndreas Rumpf <rumpf_a@web.de>2017-03-16 20:25:53 +0100
commit0874c649e926f1b4afdbfddc50014700c67b4892 (patch)
tree39a139605112e0ff3e0ce51c6aac7a5aec27b334
parent9c99973ff867110c17a706c4481a90ade1cf0758 (diff)
downloadNim-0874c649e926f1b4afdbfddc50014700c67b4892.tar.gz
Fix console logger issue; fixes #5546 (#5547)
-rw-r--r--lib/pure/logging.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pure/logging.nim b/lib/pure/logging.nim
index 598ee01d3..e2a5bed96 100644
--- a/lib/pure/logging.nim
+++ b/lib/pure/logging.nim
@@ -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.