path update for log files

This commit is contained in:
dj2ls 2022-02-21 17:58:44 +01:00
parent f293722cda
commit 84eb027241
3 changed files with 36 additions and 29 deletions

View file

@ -218,13 +218,13 @@ app.whenReady().then(() => {
if(os.platform()=='win32' || os.platform()=='win64'){
// for windows the relative path via path.join(__dirname) is not needed for some reason
//daemonProcess = exec('\\tnc\\daemon.exe', [])
daemonProcess = exec('\\tnc\\daemon.exe', [])
/*
daemonProcess = exec(path.join(process.resourcesPath, 'tnc', 'daemon.exe'), [],
{
cwd: path.join(process.resourcesPath, 'tnc'),
});
*/
}
// return process messages

View file

@ -290,19 +290,21 @@ if __name__ == '__main__':
PARSER.add_argument('--port', dest="socket_port",default=3001, help="Socket port", type=int)
ARGS = PARSER.parse_args()
static.DAEMONPORT = ARGS.socket_port
if sys.platform == 'linux':
logging_path = os.getenv("HOME") + '/.config/' + 'FreeDATA/' + 'daemon'
if sys.platform == 'darwin':
logging_path = os.getenv("HOME") + '/.config/' + 'FreeDATA/' + 'daemon'
if sys.platform == 'win32' or sys.platform == 'win64':
logging_path = os.getenv('APPDATA') + '/' + 'FreeDATA/' + 'daemon'
log_handler.setup_logging(logging_path)
try:
if sys.platform == 'linux':
logging_path = os.getenv("HOME") + '/.config/' + 'FreeDATA/' + 'daemon'
if sys.platform == 'darwin':
logging_path = os.getenv("HOME") + '/Library/' + 'Application Support' + 'FreeDATA/' + 'daemon'
if sys.platform == 'win32' or sys.platform == 'win64':
logging_path = os.getenv('APPDATA') + '/' + 'FreeDATA/' + 'daemon'
if not os.path.exists(logging_path):
os.makedirs(logging_path)
log_handler.setup_logging(logging_path)
except:
structlog.get_logger("structlog").error("[TNC] logger init error")
try:
structlog.get_logger("structlog").info("[DMN] Starting TCP/IP socket", port=static.DAEMONPORT)

View file

@ -18,6 +18,7 @@ import structlog
import log_handler
import modem
import sys
import os
import signal
import time
import multiprocessing
@ -88,19 +89,23 @@ if __name__ == '__main__':
# we need to wait until we got all parameters from argparse first before we can load the other modules
import sock
# config logging
if sys.platform == 'linux':
logging_path = os.getenv("HOME") + '/.config/' + 'FreeDATA/' + 'tnc'
if sys.platform == 'darwin':
logging_path = os.getenv("HOME") + '/.config/' + 'FreeDATA/' + 'tnc'
if sys.platform == 'win32' or sys.platform == 'win64':
logging_path = os.getenv('APPDATA') + '/' + 'FreeDATA/' + 'tnc'
log_handler.setup_logging(logging_path)
# config logging
try:
if sys.platform == 'linux':
logging_path = os.getenv("HOME") + '/.config/' + 'FreeDATA/' + 'tnc'
if sys.platform == 'darwin':
logging_path = os.getenv("HOME") + '/Library/' + 'Application Support' + 'FreeDATA/' + 'tnc'
if sys.platform == 'win32' or sys.platform == 'win64':
logging_path = os.getenv('APPDATA') + '/' + 'FreeDATA/' + 'tnc'
if not os.path.exists(logging_path):
os.makedirs(logging_path)
log_handler.setup_logging(logging_path)
except:
structlog.get_logger("structlog").error("[DMN] logger init error")
structlog.get_logger("structlog").info("[TNC] Starting FreeDATA", author="DJ2LS", year="2022", version="0.1")