change debug filepath and make it configurable
This commit is contained in:
parent
892cefe7e0
commit
73300a920a
@ -150,6 +150,7 @@ doubleTapTimeout=0.2
|
||||
[general]
|
||||
debugLevel=0
|
||||
debugMode=File
|
||||
debugFile=/var/log/fenrirscreenreader/fenrir.log
|
||||
punctuationProfile=default
|
||||
punctuationLevel=some
|
||||
respectPunctuationPause=True
|
||||
|
@ -152,9 +152,10 @@ doubleTapTimeout=0.2
|
||||
[general]
|
||||
debugLevel=0
|
||||
# debugMode sets where the debug output should send to:
|
||||
# debugMode=File writes to /var/log/fenrir.log
|
||||
# debugMode=File writes to debugFile (Default: /var/log/fenrirscreenreader/fenrir.log)
|
||||
# debugMode=Print just prints on the screen
|
||||
debugMode=File
|
||||
debugFile=/var/log/fenrirscreenreader/fenrir.log
|
||||
punctuationProfile=default
|
||||
punctuationLevel=some
|
||||
respectPunctuationPause=True
|
||||
|
@ -153,9 +153,10 @@ doubleTapTimeout=0.2
|
||||
[general]
|
||||
debugLevel=0
|
||||
# debugMode sets where the debug output should send to:
|
||||
# debugMode=File writes to /var/log/fenrir.log
|
||||
# debugMode=File writes to debugFile (Default: /var/log/fenrirscreenreader/fenrir.log)
|
||||
# debugMode=Print just prints on the screen
|
||||
debugMode=File
|
||||
debugFile=/var/log/fenrirscreenreader/fenrir.log
|
||||
punctuationProfile=default
|
||||
punctuationLevel=some
|
||||
respectPunctuationPause=True
|
||||
|
@ -101,9 +101,10 @@ doubleTapTimeout=0.2
|
||||
[general]
|
||||
debugLevel=1
|
||||
# debugMode sets where the debug output should send to:
|
||||
# debugMode=File writes to /var/log/fenrir.log
|
||||
# debugMode=File writes to debugFile (Default: /var/log/fenrirscreenreader/fenrir.log)
|
||||
# debugMode=Print just prints on the screen
|
||||
debugMode=File
|
||||
debugFile=/var/log/fenrirscreenreader/fenrir.log
|
||||
punctuationProfile=default
|
||||
punctuationLevel=some
|
||||
respectPunctuationPause=True
|
||||
|
@ -152,9 +152,10 @@ doubleTapTimeout=0.2
|
||||
[general]
|
||||
debugLevel=0
|
||||
# debugMode sets where the debug output should send to:
|
||||
# debugMode=File writes to /var/log/fenrir.log
|
||||
# debugMode=File writes to debugFile (Default: /var/log/fenrirscreenreader/fenrir.log)
|
||||
# debugMode=Print just prints on the screen
|
||||
debugMode=File
|
||||
debugFile=/var/log/fenrirscreenreader/fenrir.log
|
||||
punctuationProfile=default
|
||||
punctuationLevel=some
|
||||
respectPunctuationPause=True
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
from datetime import datetime
|
||||
import pathlib, os
|
||||
|
||||
class debugManager():
|
||||
def __init__(self, fileName='/var/log/fenrir.log'):
|
||||
self._fileName = fileName
|
||||
def __init__(self, fileName = '/var/log/fenrirscreenreader/fenrir.log'):
|
||||
self._file = None
|
||||
self._fileOpened = False
|
||||
self._fileName = fileName
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
@ -24,6 +25,9 @@ class debugManager():
|
||||
if fileName != '':
|
||||
self._fileName = fileName
|
||||
if self._fileName != '':
|
||||
directory = os.path.dirname(self._fileName)
|
||||
if not os.path.exists(directory):
|
||||
pathlib.Path(directory).mkdir(parents=True, exist_ok=True)
|
||||
self._file = open(self._fileName,'a')
|
||||
self._fileOpened = True
|
||||
|
||||
|
@ -57,6 +57,7 @@ settingsData = {
|
||||
'general':{
|
||||
'debugLevel': debug.debugLevel.DEACTIVE,
|
||||
'debugMode': 'FILE',
|
||||
'debugFile': '/var/log/fenrirscreenreader/fenrir.log',
|
||||
'punctuationProfile':'default',
|
||||
'punctuationLevel': 'some',
|
||||
'respectPunctuationPause':True,
|
||||
|
@ -260,8 +260,6 @@ class settingsManager():
|
||||
settingsRoot = '/etc/fenrirscreenreader/'
|
||||
settingsFile = cliArgs.setting
|
||||
soundRoot = '/usr/share/sounds/fenrirscreenreader/'
|
||||
environment['runtime']['debug'] = debugManager.debugManager()
|
||||
environment['runtime']['debug'].initialize(environment)
|
||||
# get fenrir settings root
|
||||
if not os.path.exists(settingsRoot):
|
||||
if os.path.exists(fenrirPath +'/../../config/'):
|
||||
@ -285,6 +283,9 @@ class settingsManager():
|
||||
validConfig = environment['runtime']['settingsManager'].loadSettings(settingsFile)
|
||||
if not validConfig:
|
||||
return None
|
||||
|
||||
environment['runtime']['debug'] = debugManager.debugManager(self.env['runtime']['settingsManager'].getSetting('general','debugFile'))
|
||||
environment['runtime']['debug'].initialize(environment)
|
||||
|
||||
if cliArgs.options != '':
|
||||
self.parseSettingArgs(cliArgs.options)
|
||||
|
Loading…
Reference in New Issue
Block a user