Types
Logger = object targets: Table[string, LogTarget] bWarnMissingTheme*: bool
LTKind = enum ltConsole, ltFile
LogTarget = ref object iMinLevel*, iMaxLevel*: int ## If the log level is not equal to or within this range it will be ignored theme*: Theme ## What theme to use with this target case kind*: LTKind of ltConsole: bAllowColors*: bool ## Whether or not to use colors with this target bAllowStdErr*: bool ## Whether things can use stderr or only stdout of ltFile: handle*: File ## This can be stdout, stderr, some actual file, etc... bCloseOnDeinit*: bool ## Should we close this file handle on logger shutdown?
ThemeDefect = object of Defect
Procs
proc add_target(self: var Logger; name: string; tgt: LogTarget) {...}{.raises: [], tags: [].}
- Add a target to the logger
proc remove_target(self: var Logger; name: string) {...}{.raises: [], tags: [].}
- Remove a target from the logger
proc logprint(self: var Logger; iSeverity: int; sMessage: string; trace: TraceInfo; context = "") {...}{. raises: [IOError, ValueError, KeyError], tags: [WriteIOEffect, TimeEffect].}
proc newLogger(): Logger {...}{.raises: [], tags: [].}
proc try_cleanup(self: LogTarget) {...}{.raises: [], tags: [].}
proc cleanup(self: var Logger) {...}{.raises: [], tags: [].}