My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 147 attachment: pyicqt.diff (1.7 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff --git a/src/debug.py b/src/debug.py
index 69a659c..6bc79dc 100644
--- a/src/debug.py
+++ b/src/debug.py
@@ -15,24 +15,29 @@ def observer(eventDict):

def observer2(eventDict):
edm = eventDict['message']
+ # LogEvent can be in tuple
+ if isinstance(edm, tuple):
+ edm = edm[0]
if isinstance(edm, LogEvent):
if edm.category == INFO and config.debugLevel < 3:
return
if (edm.category == WARN or edm.category == ERROR) and config.debugLevel < 2:
return
text = str(edm)
+ elif eventDict['isError'] and eventDict.has_key('failure'):
+ if config.debugLevel < 1: return
+ text = eventDict['failure'].getTraceback()
+ elif eventDict['isError']:
+ if config.debugLevel < 2: return
+ text = ' '.join(map(str, eventDict['message']))
+ elif eventDict.has_key('format'):
+ if config.debugLevel < 3: return
+ text = eventDict['format'] % eventDict
elif edm:
if config.debugLevel < 3: return
- text = ' '.join(map(str, edm))
+ text = ' '.join(map(str, eventDict['message']))
else:
- if eventDict['isError'] and eventDict.has_key('failure'):
- if config.debugLevel < 1: return
- text = eventDict['failure'].getTraceback()
- elif eventDict.has_key('format'):
- if config.debugLevel < 3: return
- text = eventDict['format'] % eventDict
- else:
- return
+ return

# Now log it!
timeStr = time.strftime("[%Y-%m-%d %H:%M:%S]", time.localtime(eventDict['time']))
diff --git a/src/xmlconfig.py b/src/xmlconfig.py
index 5359911..67e04dc 100644
--- a/src/xmlconfig.py
+++ b/src/xmlconfig.py
@@ -9,6 +9,7 @@ import sys
if type(True) != bool: from bool import bool

def invalidError(text):
+ LogEvent(ERROR, msg=text)
print text
print "Exiting..."
sys.exit(1)
Powered by Google Project Hosting