Skip to content
This repository was archived by the owner on Jan 22, 2023. It is now read-only.

Commit af2410a

Browse files
committed
fix: Errors and warnings print to standard error
1 parent b189af9 commit af2410a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/util.nim

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import os
22
import osproc
33
import sequtils
44
import strutils
5-
import terminal
5+
import std/terminal
66
import strformat
77
import posix
88

@@ -15,16 +15,15 @@ type
1515
deployment*: string
1616

1717
proc logError*(str: string): void {.inline.} =
18-
echo fmt"{ansiForegroundColorCode(fgRed)}Error: {str}"
19-
resetAttributes()
18+
writeLine stderr, fmt"{ansiForegroundColorCode(fgRed)}Error:{ansiResetCode} {str}"
19+
flushFile stderr
2020

2121
proc logWarn*(str: string): void {.inline.} =
22-
echo fmt"{ansiForegroundColorCode(fgYellow)}Info: {str}"
23-
resetAttributes()
22+
writeLine stderr, fmt"{ansiForegroundColorCode(fgYellow)}Info:{ansiResetCode} {str}"
23+
flushFile stderr
2424

2525
proc logInfo*(str: string): void {.inline.} =
26-
echo fmt"{ansiForegroundColorCode(fgGreen)}Info: {str}"
27-
resetAttributes()
26+
echo fmt"{ansiForegroundColorCode(fgGreen)}Info:{ansiResetCode} {str}"
2827

2928
proc die*(str: string): void {.noReturn.} =
3029
logError(fmt"{str}. Exiting")

0 commit comments

Comments
 (0)