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) TENOR_API_KEY ?= $(DEFAULT_TENOR_API_KEY)
NIM_PARAMS += -d:TENOR_API_KEY:"$(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]"
NIM_PARAMS += -d:chronicles_sinks="textlines[stdout],textlines[nocolors,file(status-desktop.log,truncate)]"
RESOURCES_LAYOUT := -d:development 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/chat/core as chat
import app/wallet/v1/core as wallet import app/wallet/v1/core as wallet
@ -28,6 +28,9 @@ proc mainProc() =
if defined(macosx) and defined(production): if defined(macosx) and defined(production):
setCurrentDir(getAppDir()) setCurrentDir(getAppDir())
let logFile = fmt"app_{getTime().toUnix}.log"
discard defaultChroniclesStream.output.open(LOGDIR & logFile, fmAppend)
var currentLanguageCode: string var currentLanguageCode: string
let fleets = let fleets =

View File

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

View File

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