fix: logs on node tab
This commit is contained in:
parent
50de4594a5
commit
1c30eff74b
2
Makefile
2
Makefile
|
@ -367,7 +367,7 @@ $(FCITX5_QT): | deps
|
|||
.. $(HANDLE_OUTPUT) && \
|
||||
$(FCITX5_QT_BUILD_CMD)
|
||||
|
||||
PRODUCTION_PARAMETERS := -d:production -d:chronicles_enabled=off
|
||||
PRODUCTION_PARAMETERS := -d:production -d:chronicles_sinks=textlines[stdout],textlines[nocolors,dynamic]
|
||||
|
||||
$(STATUS_CLIENT_APPIMAGE): override RESOURCES_LAYOUT := $(PRODUCTION_PARAMETERS)
|
||||
$(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop $(FCITX5_QT)
|
||||
|
|
|
@ -40,16 +40,7 @@ proc determineStatusAppIconPath(): string =
|
|||
return "/../status-dev.svg"
|
||||
|
||||
proc prepareLogging() =
|
||||
# do not create log file
|
||||
if defined(production):
|
||||
return
|
||||
|
||||
# log level can be overriden by LOG_LEVEL env parameter
|
||||
let logLvl = try: parseEnum[LogLevel](getEnv("LOG_LEVEL"))
|
||||
except: NONE
|
||||
|
||||
setLogLevel(logLvl)
|
||||
|
||||
# Outputs logs in the node tab
|
||||
when compiles(defaultChroniclesStream.output.writer):
|
||||
defaultChroniclesStream.output.writer =
|
||||
proc (logLevel: LogLevel, msg: LogOutputStr) {.gcsafe, raises: [Defect].} =
|
||||
|
@ -59,6 +50,14 @@ proc prepareLogging() =
|
|||
except:
|
||||
logLoggingFailure(cstring(msg), getCurrentException())
|
||||
|
||||
# do not create log file
|
||||
when not defined(production):
|
||||
# log level can be overriden by LOG_LEVEL env parameter
|
||||
let logLvl = try: parseEnum[LogLevel](getEnv("LOG_LEVEL"))
|
||||
except: NONE
|
||||
|
||||
setLogLevel(logLvl)
|
||||
|
||||
let formattedDate = now().format("yyyyMMdd'_'HHmmss")
|
||||
let logFile = fmt"app_{formattedDate}.log"
|
||||
discard defaultChroniclesStream.outputs[1].open(LOGDIR & logFile, fmAppend)
|
||||
|
|
Loading…
Reference in New Issue