From b4dd3e76754a845238799916fe2ba5eb1e7e16df Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 30 Aug 2016 22:52:54 +0200 Subject: [PATCH] debug trash --- src/fenrir-package/core/inputManager.py | 2 +- src/fenrir-package/fenrir.py | 3 ++- src/fenrir-package/screen/linux.py | 12 ++++++------ src/fenrir-package/utils/debug.py | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/fenrir-package/core/inputManager.py b/src/fenrir-package/core/inputManager.py index 0c4580d8..3cc8cb86 100644 --- a/src/fenrir-package/core/inputManager.py +++ b/src/fenrir-package/core/inputManager.py @@ -42,7 +42,7 @@ class inputManager(): except: pass except Exception as e: - environment['runtime']['debug'].writeDebugOut(environment,str(e),0) + environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR) self.freeDevices() time.sleep(0.01) environment['input']['currShortcutString'] = self.getShortcutString(environment) diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index 37283f92..afaf91ba 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -11,6 +11,7 @@ if not os.getcwd() in sys.path: from core import environment from core import settingsManager +from utils import debug class fenrir(): def __init__(self): @@ -22,7 +23,7 @@ class fenrir(): #self.threadonInput.start() while(self.environment['generalInformation']['running']): self.handleProcess() - self.environment['runtime']['debug'].writeDebugOut(environment,'happy loop at'+str(time.time()),0) + self.environment['runtime']['debug'].writeDebugOut(self.environment,'happy loop at'+str(time.time()),debug.debugLevel.ERROR) self.shutdown() diff --git a/src/fenrir-package/screen/linux.py b/src/fenrir-package/screen/linux.py index 7d6f3308..84fa5226 100644 --- a/src/fenrir-package/screen/linux.py +++ b/src/fenrir-package/screen/linux.py @@ -28,7 +28,7 @@ class screen(): if len(newContentBytes) < 5: return environment except Exception as e: - environment['runtime']['debug'].writeDebugOut(environment,str(e),0) + environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR) return environment screenEncoding = environment['runtime']['settingsManager'].getSetting(environment,'screen', 'encoding') environment['generalInformation']['suspend'] = newTTY in \ @@ -68,9 +68,9 @@ class screen(): environment['screenData']['newDelta'] = '' environment['screenData']['oldNegativeDelta'] = '' environment['screenData']['newNegativeDelta'] = '' - environment['runtime']['debug'].writeDebugOut(environment,'____CONT START_____'),0) - environment['runtime']['debug'].writeDebugOut(environment,environment['screenData']['newContentText']+ str(time.time()),0) - environment['runtime']['debug'].writeDebugOut(environment,'____CONT END____'),0) + environment['runtime']['debug'].writeDebugOut(environment,'____CONT START_____',debug.debugLevel.ERROR) + environment['runtime']['debug'].writeDebugOut(environment,environment['screenData']['newContentText']+ str(time.time()),debug.debugLevel.ERROR) + environment['runtime']['debug'].writeDebugOut(environment,'____CONT END____',debug.debugLevel.ERROR) # changes on the screen if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \ @@ -79,7 +79,7 @@ class screen(): environment['screenData']['newContentText'] != '': environment['screenData']['newDelta'] = environment['screenData']['newContentText'] else: - environment['runtime']['debug'].writeDebugOut(environment,"diff start-------------"+ str(time.time()),0) + environment['runtime']['debug'].writeDebugOut(environment,"diff start-------------"+ str(time.time()),debug.debugLevel.ERROR) diffStart = 0 if environment['screenData']['oldCursor']['x'] != environment['screenData']['newCursor']['x'] and \ environment['screenData']['oldCursor']['y'] == environment['screenData']['newCursor']['y'] and \ @@ -92,7 +92,7 @@ class screen(): environment['screenData']['newContentText'][diffStart:].split('\n')) diffList = list(diff) - environment['runtime']['debug'].writeDebugOut(environment,"diff end-------------"+ str(time.time()),0) + environment['runtime']['debug'].writeDebugOut(environment,"diff end-------------"+ str(time.time()),debug.debugLevel.ERROR) environment['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ ')) environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- ')) diff --git a/src/fenrir-package/utils/debug.py b/src/fenrir-package/utils/debug.py index f73b6aee..fbc9a214 100644 --- a/src/fenrir-package/utils/debug.py +++ b/src/fenrir-package/utils/debug.py @@ -28,7 +28,7 @@ class debug(): if fileName != '': self._fileName = fileName if self._fileName != '': - self._file = open(self._fileName,'w') + self._file = open(self._fileName,'a') self._fileOpened = True def writeDebugOut(self, environment, text, level = debugLevel.DEACTIVE):