mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 10:10:45 -06:00
keep console logger handy to update
This commit is contained in:
parent
a8ce1b651e
commit
8114ac1b3b
4 changed files with 12 additions and 1175 deletions
|
@ -33,7 +33,7 @@ hwylCli:
|
||||||
? "set minimal"
|
? "set minimal"
|
||||||
- m
|
- m
|
||||||
preSub:
|
preSub:
|
||||||
setupLoggers(debug)
|
setupLoggers()
|
||||||
updateContext(host, flake, debug, resetCache)
|
updateContext(host, flake, debug, resetCache)
|
||||||
|
|
||||||
subcommands:
|
subcommands:
|
||||||
|
@ -69,7 +69,6 @@ hwylCli:
|
||||||
# when really I want it to only happen in the lowest "subcommand"
|
# when really I want it to only happen in the lowest "subcommand"
|
||||||
# needs to be fixed in hwylterm
|
# needs to be fixed in hwylterm
|
||||||
preSub:
|
preSub:
|
||||||
setupLoggers(debug)
|
|
||||||
updateContext(host, flake, debug, resetCache)
|
updateContext(host, flake, debug, resetCache)
|
||||||
subcommands:
|
subcommands:
|
||||||
[update]
|
[update]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import std/[logging, os, strformat, strutils]
|
import std/[logging, os, strformat, strutils]
|
||||||
from std/nativesockets import getHostname
|
from std/nativesockets import getHostname
|
||||||
import hwylterm, hwylterm/logging
|
import hwylterm, hwylterm/logging
|
||||||
|
import ./logging
|
||||||
|
|
||||||
type
|
type
|
||||||
OizysContext* = object
|
OizysContext* = object
|
||||||
|
@ -36,6 +37,8 @@ proc updateContext*(
|
||||||
) =
|
) =
|
||||||
if host.len > 0: oc.hosts = host
|
if host.len > 0: oc.hosts = host
|
||||||
oc.debug = debug
|
oc.debug = debug
|
||||||
|
if debug:
|
||||||
|
consoleLogger.levelThreshold = lvlAll
|
||||||
oc.resetCache = resetCache
|
oc.resetCache = resetCache
|
||||||
if flake != "":
|
if flake != "":
|
||||||
oc.flake =
|
oc.flake =
|
||||||
|
|
|
@ -25,16 +25,16 @@ proc getOizysLogPath(): string =
|
||||||
|
|
||||||
setLogFilter(lvlAll)
|
setLogFilter(lvlAll)
|
||||||
|
|
||||||
proc setupLoggers*(debug: bool) =
|
var consoleLogger* =
|
||||||
let logLevel =
|
|
||||||
if not debug: lvlInfo
|
|
||||||
else: lvlAll
|
|
||||||
addHandler(
|
|
||||||
newHwylConsoleLogger(
|
newHwylConsoleLogger(
|
||||||
fmtPrefix = $bb"[b magenta]oizys",
|
fmtPrefix = $bb"[b magenta]oizys",
|
||||||
fmtSuffix = " ",
|
fmtSuffix = " ",
|
||||||
levelThreshold = logLevel
|
levelThreshold = lvlInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
|
proc setupLoggers*() =
|
||||||
|
addHandler(
|
||||||
|
consoleLogger
|
||||||
)
|
)
|
||||||
addHandler(
|
addHandler(
|
||||||
newRollingFileLogger(
|
newRollingFileLogger(
|
||||||
|
|
1165
updated.lock
1165
updated.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue