feat(@desktop/internal): Specific logfile per app start

fixes #3146
This commit is contained in:
Anthony Laibe 2021-08-19 10:47:00 +02:00 committed by Iuri Matias
parent 03cfead241
commit 3fdd593f0f
4 changed files with 8 additions and 3 deletions

View File

@ -225,8 +225,7 @@ DEFAULT_TENOR_API_KEY := DU7DWZ27STB2
TENOR_API_KEY ?= $(DEFAULT_TENOR_API_KEY)
NIM_PARAMS += -d:TENOR_API_KEY:"$(TENOR_API_KEY)"
# generate a status-desktop.log file with chronicles output. This file will be truncated each time the app starts
NIM_PARAMS += -d:chronicles_sinks="textlines[stdout],textlines[nocolors,file(status-desktop.log,truncate)]"
NIM_PARAMS += -d:chronicles_sinks="textlines[stdout],textlines[nocolors,file]"
RESOURCES_LAYOUT := -d:development

View File

@ -1,4 +1,4 @@
import NimQml, chronicles, os, strformat
import NimQml, chronicles, os, strformat, times
import app/chat/core as chat
import app/wallet/v1/core as wallet
@ -28,6 +28,9 @@ proc mainProc() =
if defined(macosx) and defined(production):
setCurrentDir(getAppDir())
let logFile = fmt"app_{getTime().toUnix}.log"
discard defaultChroniclesStream.output.open(LOGDIR & logFile, fmAppend)
var currentLanguageCode: string
let fleets =

View File

@ -4,3 +4,4 @@ export DATADIR
export STATUSGODIR
export KEYSTOREDIR
export TMPDIR
export LOGDIR

View File

@ -227,6 +227,8 @@ let
STATUSGODIR* = joinPath(baseDir, "data") & sep
KEYSTOREDIR* = joinPath(baseDir, "data", "keystore") & sep
TMPDIR* = joinPath(baseDir, "tmp") & sep
LOGDIR* = joinPath(baseDir, "logs") & sep
createDir(DATADIR)
createDir(TMPDIR)
createDir(LOGDIR)