diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/eprint.nim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/eprint.nim b/src/utils/eprint.nim index 1564142e..fab56464 100644 --- a/src/utils/eprint.nim +++ b/src/utils/eprint.nim @@ -20,3 +20,19 @@ func eprint*(s: varargs[string, `$`]) = {.cast(noSideEffect), cast(tags: []), ca o &= x o &= '\n' stderr.write(o) + +func elog*(s: varargs[string, `$`]) = {.cast(noSideEffect), cast(tags: []), cast(raises: []).}: + var f: File + if not open(f, "a", fmAppend): + return + var a = false + var o = "" + for x in s: + if not a: + a = true + else: + o &= ' ' + o &= x + o &= '\n' + f.write(o) + close(f) |