Commit 3e92bb2d authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

parent bb178344
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
__version__='$Revision: 1.2 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
import sys, os import sys, os
import signal, zLOG import signal
from logging import getLogger
LOG = getLogger('SignalHandler')
class SignalHandler: class SignalHandler:
...@@ -36,9 +39,7 @@ class SignalHandler: ...@@ -36,9 +39,7 @@ class SignalHandler:
items = self.registry[signum] = [] items = self.registry[signum] = []
signal.signal(signum, self.signalHandler) signal.signal(signum, self.signalHandler)
signame = get_signal_name(signum) signame = get_signal_name(signum)
zLOG.LOG('Z2', zLOG.BLATHER, "Installed sighandler for %s" % ( LOG.debug("Installed sighandler for %s" % signame)
signame
))
items.insert(0, handler) items.insert(0, handler)
def getRegisteredSignals(self): def getRegisteredSignals(self):
...@@ -49,7 +50,7 @@ class SignalHandler: ...@@ -49,7 +50,7 @@ class SignalHandler:
def signalHandler(self, signum, frame): def signalHandler(self, signum, frame):
"""Meta signal handler that dispatches to registered handlers.""" """Meta signal handler that dispatches to registered handlers."""
signame = get_signal_name(signum) signame = get_signal_name(signum)
zLOG.LOG('Z2', zLOG.INFO , "Caught signal %s" % signame) LOG.info("Caught signal %s" % signame)
for handler in self.registry.get(signum, []): for handler in self.registry.get(signum, []):
# Never let a bad handler prevent the standard signal # Never let a bad handler prevent the standard signal
...@@ -59,9 +60,8 @@ class SignalHandler: ...@@ -59,9 +60,8 @@ class SignalHandler:
# if we trap SystemExit, we can't restart # if we trap SystemExit, we can't restart
raise raise
except: except:
zLOG.LOG('Z2', zLOG.WARNING, LOG.warn('A handler for %s failed!' % signame,
'A handler for %s failed!' % signame, exc_info=sys.exc_info())
error=sys.exc_info())
_signals = None _signals = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment