nim-codex/tests/integration/nodeconfig.nim
Adam Uhlíř e5df8c50d3
style: nph formatting (#1067)
* style: nph setup

* chore: formates codex/ and tests/ folder with nph 0.6.1
2025-01-21 20:54:46 +00:00

26 lines
657 B
Nim

import pkg/chronicles
import pkg/questionable
export chronicles
type NodeConfig* = ref object of RootObj
logFile*: bool
logLevel*: ?LogLevel
debugEnabled*: bool
proc debug*[T: NodeConfig](config: T, enabled = true): T =
## output log in stdout
var startConfig = config
startConfig.debugEnabled = enabled
return startConfig
proc withLogFile*[T: NodeConfig](config: T, logToFile: bool = true): T =
var startConfig = config
startConfig.logFile = logToFile
return startConfig
proc withLogLevel*[T: NodeConfig](config: NodeConfig, level: LogLevel): T =
var startConfig = config
startConfig.logLevel = some level
return startConfig