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)`
|
DESKTOP_VERSION=`cat $(VERSIONFILE)`
|
||||||
NIM_PARAMS += -d:DESKTOP_VERSION="$(DESKTOP_VERSION)"
|
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
|
$(DOTHERSIDE): | deps
|
||||||
echo -e $(BUILD_MSG) "DOtherSide"
|
echo -e $(BUILD_MSG) "DOtherSide"
|
||||||
+ cd vendor/DOtherSide && \
|
+ cd vendor/DOtherSide && \
|
||||||
|
|
|
@ -2,6 +2,7 @@ import NimQml, json, chronicles
|
||||||
|
|
||||||
import ../../../app/core/eventemitter
|
import ../../../app/core/eventemitter
|
||||||
import ../../../app/core/tasks/[qt, threadpool]
|
import ../../../app/core/tasks/[qt, threadpool]
|
||||||
|
import ../../../constants
|
||||||
|
|
||||||
import ../settings/service as settings_service
|
import ../settings/service as settings_service
|
||||||
import ../network/types
|
import ../network/types
|
||||||
|
@ -13,9 +14,6 @@ include async_tasks
|
||||||
logScope:
|
logScope:
|
||||||
topics = "about-service"
|
topics = "about-service"
|
||||||
|
|
||||||
# This is changed during compilation by reading the VERSION file
|
|
||||||
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
|
|
||||||
|
|
||||||
type
|
type
|
||||||
VersionArgs* = ref object of Args
|
VersionArgs* = ref object of Args
|
||||||
version*: string
|
version*: string
|
||||||
|
|
|
@ -64,3 +64,8 @@ proc ensureDirectories*(dataDir, tmpDir, logDir: string) =
|
||||||
createDir(dataDir)
|
createDir(dataDir)
|
||||||
createDir(tmpDir)
|
createDir(tmpDir)
|
||||||
createDir(logDir)
|
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:
|
except:
|
||||||
logLoggingFailure(cstring(msg), getCurrentException())
|
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)
|
discard defaultChroniclesStream.outputs[1].open(LOGDIR & logFile, fmAppend)
|
||||||
|
|
||||||
proc setupRemoteSignalsHandling() =
|
proc setupRemoteSignalsHandling() =
|
||||||
|
@ -134,6 +135,10 @@ proc mainProc() =
|
||||||
info "Terminating the app as the second instance"
|
info "Terminating the app as the second instance"
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
|
info fmt("Version: {DESKTOP_VERSION}")
|
||||||
|
info fmt("Commit: {GIT_COMMIT}")
|
||||||
|
info "Current date:", currentDateTime=now()
|
||||||
|
|
||||||
info "starting application controller..."
|
info "starting application controller..."
|
||||||
appController.start()
|
appController.start()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue