mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-21 21:50:43 -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"
|
||||
- m
|
||||
preSub:
|
||||
setupLoggers(debug)
|
||||
setupLoggers()
|
||||
updateContext(host, flake, debug, resetCache)
|
||||
|
||||
subcommands:
|
||||
|
@ -69,7 +69,6 @@ hwylCli:
|
|||
# when really I want it to only happen in the lowest "subcommand"
|
||||
# needs to be fixed in hwylterm
|
||||
preSub:
|
||||
setupLoggers(debug)
|
||||
updateContext(host, flake, debug, resetCache)
|
||||
subcommands:
|
||||
[update]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import std/[logging, os, strformat, strutils]
|
||||
from std/nativesockets import getHostname
|
||||
import hwylterm, hwylterm/logging
|
||||
import ./logging
|
||||
|
||||
type
|
||||
OizysContext* = object
|
||||
|
@ -36,6 +37,8 @@ proc updateContext*(
|
|||
) =
|
||||
if host.len > 0: oc.hosts = host
|
||||
oc.debug = debug
|
||||
if debug:
|
||||
consoleLogger.levelThreshold = lvlAll
|
||||
oc.resetCache = resetCache
|
||||
if flake != "":
|
||||
oc.flake =
|
||||
|
|
|
@ -25,16 +25,16 @@ proc getOizysLogPath(): string =
|
|||
|
||||
setLogFilter(lvlAll)
|
||||
|
||||
proc setupLoggers*(debug: bool) =
|
||||
let logLevel =
|
||||
if not debug: lvlInfo
|
||||
else: lvlAll
|
||||
addHandler(
|
||||
newHwylConsoleLogger(
|
||||
var consoleLogger* =
|
||||
newHwylConsoleLogger(
|
||||
fmtPrefix = $bb"[b magenta]oizys",
|
||||
fmtSuffix = " ",
|
||||
levelThreshold = logLevel
|
||||
)
|
||||
levelThreshold = lvlInfo
|
||||
)
|
||||
|
||||
proc setupLoggers*() =
|
||||
addHandler(
|
||||
consoleLogger
|
||||
)
|
||||
addHandler(
|
||||
newRollingFileLogger(
|
||||
|
|
1165
updated.lock
1165
updated.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue