feat(conf): ability to set log level in config
This commit is contained in:
@@ -24,6 +24,7 @@ hmacKey = "secretkey" # random key for cryptographic signing of video urls
|
|||||||
base64Media = false # use base64 encoding for proxied media urls
|
base64Media = false # use base64 encoding for proxied media urls
|
||||||
enableRSS = true # set this to false to disable RSS feeds
|
enableRSS = true # set this to false to disable RSS feeds
|
||||||
enableDebug = false # enable request logs and debug endpoints (/.sessions)
|
enableDebug = false # enable request logs and debug endpoints (/.sessions)
|
||||||
|
logLevel = "info" # log level (debug, info, warn, error, fatal)
|
||||||
proxy = "" # http/https url, SOCKS proxies are not supported
|
proxy = "" # http/https url, SOCKS proxies are not supported
|
||||||
proxyAuth = ""
|
proxyAuth = ""
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ proc getConfig*(path: string): (Config, parseCfg.Config) =
|
|||||||
minTokens: cfg.get("Config", "tokenCount", 10),
|
minTokens: cfg.get("Config", "tokenCount", 10),
|
||||||
enableRss: cfg.get("Config", "enableRSS", true),
|
enableRss: cfg.get("Config", "enableRSS", true),
|
||||||
enableDebug: cfg.get("Config", "enableDebug", false),
|
enableDebug: cfg.get("Config", "enableDebug", false),
|
||||||
|
logLevel: cfg.get("Config", "logLevel", ""),
|
||||||
proxy: cfg.get("Config", "proxy", ""),
|
proxy: cfg.get("Config", "proxy", ""),
|
||||||
proxyAuth: cfg.get("Config", "proxyAuth", "")
|
proxyAuth: cfg.get("Config", "proxyAuth", "")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -52,10 +52,17 @@ initSessionPool(cfg, sessionsPath)
|
|||||||
|
|
||||||
addHandler(new(ColoredLogger))
|
addHandler(new(ColoredLogger))
|
||||||
|
|
||||||
if cfg.enableDebug:
|
let level = case cfg.logLevel.toLowerAscii
|
||||||
setLogFilter(lvlDebug)
|
of "debug": lvlDebug
|
||||||
else:
|
of "info": lvlInfo
|
||||||
setLogFilter(lvlInfo)
|
of "warn": lvlWarn
|
||||||
|
of "error": lvlError
|
||||||
|
of "fatal": lvlFatal
|
||||||
|
of "none": lvlNone
|
||||||
|
else:
|
||||||
|
if cfg.enableDebug: lvlDebug else: lvlInfo
|
||||||
|
|
||||||
|
setLogFilter(level)
|
||||||
|
|
||||||
info &"Starting Nitter at {getUrlPrefix(cfg)}"
|
info &"Starting Nitter at {getUrlPrefix(cfg)}"
|
||||||
|
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ type
|
|||||||
minTokens*: int
|
minTokens*: int
|
||||||
enableRss*: bool
|
enableRss*: bool
|
||||||
enableDebug*: bool
|
enableDebug*: bool
|
||||||
|
logLevel*: string
|
||||||
proxy*: string
|
proxy*: string
|
||||||
proxyAuth*: string
|
proxyAuth*: string
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user