freemyipod r499 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r498‎ | r499 | r500 >
Date:00:22, 1 February 2011
Author:farthen
Status:new
Tags:
Comment:
libemcore: Let the users pass the misc.Logger object themselves and implement this is emcore.py
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)
  • /emcore/trunk/tools/libemcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -129,7 +129,7 @@
130130 def __init__(self):
131131 self.logger = Logger()
132132 try:
133 - self.emcore = libemcore.Emcore(loglevel = 2)
 133+ self.emcore = libemcore.Emcore(logger = self.logger)
134134 except libemcore.DeviceNotFoundError:
135135 self.logger.error("No emCORE device found!\n")
136136 exit(1)
Index: emcore/trunk/tools/libemcore.py
@@ -96,9 +96,12 @@
9797 It also adds a "timeout" argument to every function to access this
9898 feature from external. So DON'T EVER use a parameter called 'timeout'
9999 in your commands. Variables are ok.
 100+
 101+ If you want to enable logging please pass a misc.Logger object to the
 102+ constructor.
100103 """
101 - def __init__(self, loglevel = 2, logtarget = "stdout", logfile = "tools.log"):
102 - self.logger = Logger(loglevel, logtarget, logfile)
 104+ def __init__(self, logger = Logger(loglevel = -1)):
 105+ self.logger = logger
103106 self.logger.debug("Initializing Emcore object\n")
104107 self.lib = Lib(self.logger)
105108