Skip to content

Commit

Permalink
move msgs.log to nimsuggest (#903)
Browse files Browse the repository at this point in the history
Move the `log` procedure, which is only intended for use by the
`nimsuggest` tool, from the `msgs` module to `nimsuggest`.

---------

Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
  • Loading branch information
bung87 and zerbina authored Sep 15, 2023
1 parent 7472029 commit c1607a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 0 additions & 6 deletions compiler/front/msgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,6 @@ proc msgWrite*(conf: ConfigRef; s: string, flags: MsgFlags = {}) =
when defined(windows):
flushFile(stderr)

proc log*(s: string) =
var f: File
if open(f, getHomeDir() / "nimsuggest.log", fmAppend):
f.writeLine(s)
close(f)

proc quit(conf: ConfigRef; withTrace: bool) {.gcsafe.} =
if conf.isDefined("nimDebug"):
quitOrRaise(conf)
Expand Down
8 changes: 8 additions & 0 deletions nimsuggest/nimsuggest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ proc writelnToChannel(line: string) =
proc sugResultHook(s: Suggest) =
results.send(s)

proc log(s: string) =
## Appends `s` as new line to the `nimsuggest.log` file in the user's home
## directory.
var f: File
if open(f, getHomeDir() / "nimsuggest.log", fmAppend):
f.writeLine(s)
close(f)

proc myLog(conf: ConfigRef, s: string, flags: MsgFlags = {}) =
if gLogging:
log(s)
Expand Down

0 comments on commit c1607a1

Please sign in to comment.