From: Ralf Jung Date: Wed, 9 Oct 2013 18:04:20 +0000 (+0200) Subject: get rid of __main__ hack X-Git-Url: https://git.ralfj.de/saartuer.git/commitdiff_plain/d5363aceeb231a73d940a084ec235d832f767b8f?ds=sidebyside;hp=189386bae18851e7e6eee425de08deec47ff9a14 get rid of __main__ hack --- diff --git a/libtuer.py b/libtuer.py index e31ce27..e0898d5 100644 --- a/libtuer.py +++ b/libtuer.py @@ -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)