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) && \ .. $(HANDLE_OUTPUT) && \
$(FCITX5_QT_BUILD_CMD) $(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): override RESOURCES_LAYOUT := $(PRODUCTION_PARAMETERS)
$(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop $(FCITX5_QT) $(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" return "/../status-dev.svg"
proc prepareLogging() = proc prepareLogging() =
# do not create log file # Outputs logs in the node tab
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)
when compiles(defaultChroniclesStream.output.writer): when compiles(defaultChroniclesStream.output.writer):
defaultChroniclesStream.output.writer = defaultChroniclesStream.output.writer =
proc (logLevel: LogLevel, msg: LogOutputStr) {.gcsafe, raises: [Defect].} = proc (logLevel: LogLevel, msg: LogOutputStr) {.gcsafe, raises: [Defect].} =
@ -59,9 +50,17 @@ proc prepareLogging() =
except: except:
logLoggingFailure(cstring(msg), getCurrentException()) logLoggingFailure(cstring(msg), getCurrentException())
let formattedDate = now().format("yyyyMMdd'_'HHmmss") # do not create log file
let logFile = fmt"app_{formattedDate}.log" when not defined(production):
discard defaultChroniclesStream.outputs[1].open(LOGDIR & logFile, fmAppend) # 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() = proc setupRemoteSignalsHandling() =
# Please note that this must use the `cdecl` calling convention because # Please note that this must use the `cdecl` calling convention because