feature(desktop/internal): Improve log file naming convention
Logs are named app_yyyyMMdd_HHmmss.log Version, commit and start date information are displayed in logs at the begining. Injecting commit version from Makefile. Moving DESKTOP_VERSION const to constants.nim Fix #3611
This commit is contained in:
parent
cfd84d5ba0
commit
3711ab613a
3
Makefile
3
Makefile
|
@ -195,6 +195,9 @@ VERSIONFILE=VERSION
|
|||
DESKTOP_VERSION=`cat $(VERSIONFILE)`
|
||||
NIM_PARAMS += -d:DESKTOP_VERSION="$(DESKTOP_VERSION)"
|
||||
|
||||
GIT_COMMIT=`git log --pretty=format:'%h' -n 1`
|
||||
NIM_PARAMS += -d:GIT_COMMIT="$(GIT_COMMIT)"
|
||||
|
||||
$(DOTHERSIDE): | deps
|
||||
echo -e $(BUILD_MSG) "DOtherSide"
|
||||
+ cd vendor/DOtherSide && \
|
||||
|
|
|
@ -2,6 +2,7 @@ import NimQml, json, chronicles
|
|||
|
||||
import ../../../app/core/eventemitter
|
||||
import ../../../app/core/tasks/[qt, threadpool]
|
||||
import ../../../constants
|
||||
|
||||
import ../settings/service as settings_service
|
||||
import ../network/types
|
||||
|
@ -13,9 +14,6 @@ include async_tasks
|
|||
logScope:
|
||||
topics = "about-service"
|
||||
|
||||
# This is changed during compilation by reading the VERSION file
|
||||
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
|
||||
|
||||
type
|
||||
VersionArgs* = ref object of Args
|
||||
version*: string
|
||||
|
|
|
@ -64,3 +64,8 @@ proc ensureDirectories*(dataDir, tmpDir, logDir: string) =
|
|||
createDir(dataDir)
|
||||
createDir(tmpDir)
|
||||
createDir(logDir)
|
||||
|
||||
# This is changed during compilation by reading the VERSION file
|
||||
const DESKTOP_VERSION* {.strdefine.} = "0.0.0"
|
||||
# This is changed during compilation by executing git command
|
||||
const GIT_COMMIT* {.strdefine.} = ""
|
||||
|
|
|
@ -49,7 +49,8 @@ proc prepareLogging() =
|
|||
except:
|
||||
logLoggingFailure(cstring(msg), getCurrentException())
|
||||
|
||||
let logFile = fmt"app_{getTime().toUnix}.log"
|
||||
let formattedDate = now().format("yyyyMMdd'_'HHmmss")
|
||||
let logFile = fmt"app_{formattedDate}.log"
|
||||
discard defaultChroniclesStream.outputs[1].open(LOGDIR & logFile, fmAppend)
|
||||
|
||||
proc setupRemoteSignalsHandling() =
|
||||
|
@ -134,6 +135,10 @@ proc mainProc() =
|
|||
info "Terminating the app as the second instance"
|
||||
quit()
|
||||
|
||||
info fmt("Version: {DESKTOP_VERSION}")
|
||||
info fmt("Commit: {GIT_COMMIT}")
|
||||
info "Current date:", currentDateTime=now()
|
||||
|
||||
info "starting application controller..."
|
||||
appController.start()
|
||||
|
||||
|
|
Loading…
Reference in New Issue