if not os.path.exists(logsdir) :
os.mkdir(logsdir)
if not os.path.exists(logsdir) :
os.mkdir(logsdir)
-
-class MinWiiStreamHandler(logging.StreamHandler) :
- logfile = None
- stream = None
- env = []
+if os.environ.has_key('WINWII_NO_LOG') :
+ class MinWiiStreamHandler(logging.Handler) :
+ def emit(record) : pass
+else :
+ class MinWiiStreamHandler(logging.StreamHandler) :
+ logfile = None
+ stream = None
+ env = []
- def __init__(self) :
- logging.Handler.__init__(self)
- if self.stream is None :
- self.setNewStream()
+ def __init__(self) :
+ logging.Handler.__init__(self)
+ if self.stream is None :
+ self.setNewStream()
- @classmethod
- def setNewStream(cls) :
- if cls.stream and not cls.stream.closed :
- cls.stream.close()
- logfile = os.path.join(logsdir, datetime.datetime.now().strftime('%Y-%m-%d-%H_%M_%S.log'))
- cls.stream = open(logfile, 'a')
+ @classmethod
+ def setNewStream(cls) :
+ if cls.stream and not cls.stream.closed :
+ cls.stream.close()
+ logfile = os.path.join(logsdir, datetime.datetime.now().strftime('%Y-%m-%d-%H_%M_%S.log'))
+ cls.stream = open(logfile, 'a')
- def emit(self, record) :
- if record.name == 'minwii.env' :
- if record.getMessage()=='NEW_LOG_FILE' :
- self.setNewStream()
- for rec in self.env :
- logging.StreamHandler.emit(self, rec)
- return
- else :
- self.env.append(record)
- logging.StreamHandler.emit(self, record)
+ def emit(self, record) :
+ if record.name == 'minwii.env' :
+ if record.getMessage()=='NEW_LOG_FILE' :
+ self.setNewStream()
+ for rec in self.env :
+ logging.StreamHandler.emit(self, rec)
+ return
+ else :
+ self.env.append(record)
+ logging.StreamHandler.emit(self, record)
class EventLoggerAdapter(logging.LoggerAdapter) :
class EventLoggerAdapter(logging.LoggerAdapter) :
+import os
+os.environ['WINWII_NO_LOG'] = '1'
from Tkinter import *
import tkFileDialog
from glob import glob
from Tkinter import *
import tkFileDialog
from glob import glob
from os.path import join as pjoin
from os.path import basename
from os.path import getsize
from os.path import join as pjoin
from os.path import basename
from os.path import getsize
+def main() :
+ app = Application()
+ app.master.title("Analyseur des sessions MINWii")
+ app.mainloop()
-app = Application()
-app.master.title("Analyseur des sessions MINWii")
-app.mainloop()
+if __name__ == '__main__' :
+ main()
\ No newline at end of file