get rid of __main__ hack
authorRalf Jung <post@ralfj.de>
Wed, 9 Oct 2013 18:04:20 +0000 (20:04 +0200)
committerRalf Jung <post@ralfj.de>
Wed, 9 Oct 2013 18:04:20 +0000 (20:04 +0200)
libtuer.py

index e31ce2728497f1c2dab8bfadad7d3b7a153ec41c..e0898d580696045c53eacb5a6dc0aed8bf91d0f7 100644 (file)
@@ -3,15 +3,13 @@ import logging, logging.handlers, os, time, queue, threading, subprocess, multip
 # logging function
 class Logger:
        def __init__ (self):
-               import __main__ as main
-               self.name = os.path.basename(main.__file__)
-               self.logger = logging.getLogger(self.name)
+               self.logger = logging.getLogger("tuerd")
                self.logger.setLevel(logging.INFO)
                self.handler = logging.handlers.SysLogHandler(address = '/dev/log', facility = logging.handlers.SysLogHandler.LOG_LOCAL0)
                self.logger.addHandler(self.handler)
        
        def log (self, lvl, what):
-               thestr = "%s[%d]: %s" % (self.name,os.getpid(),what)
+               thestr = "%s[%d]: %s" % ("osspd", os.getpid(), what)
                print (thestr)
                self.logger.log(lvl, thestr)