fix: logs on node tab

This commit is contained in:
Richard Ramos 2022-07-01 10:59:25 -04:00 committed by Iuri Matias
parent 50de4594a5
commit 1c30eff74b
2 changed files with 13 additions and 14 deletions

View File

@ -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)

View File

@ -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,9 +50,17 @@ proc prepareLogging() =
except:
logLoggingFailure(cstring(msg), getCurrentException())
let formattedDate = now().format("yyyyMMdd'_'HHmmss")
let logFile = fmt"app_{formattedDate}.log"
discard defaultChroniclesStream.outputs[1].open(LOGDIR & logFile, fmAppend)
# 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)
proc setupRemoteSignalsHandling() =
# Please note that this must use the `cdecl` calling convention because