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