chiark / gitweb /
crashing and msgs
[hippotat.git] / hippotat / __init__.py
index 90476f5950ad89d3481e38cb670ac28178efe443..3e8649ae1e122f7b4252ad4dbc4453e54ffca673 100644 (file)
@@ -40,6 +40,7 @@ class DBG(twisted.python.constants.Names):
   QUEUE_CTRL = NamedConstant()
   HTTP_FULL = NamedConstant()
   SLIP_FULL = NamedConstant()
+  CTRL_DUMP = NamedConstant()
 
 _hex_codec = codecs.getencoder('hex_codec')
 
@@ -48,9 +49,9 @@ log = twisted.logger.Logger()
 def log_debug(dflag, msg, idof=None, d=None):
   #print('---------------->',repr((dflag, msg, idof, d)), file=sys.stderr)
   if idof is not None:
-    msg = '[%d] %s' % (id(idof), msg)
+    msg = '[%#x] %s' % (id(idof), msg)
   if d is not None:
-    #d = d[0:64]
+    d = d[0:64]
     d = _hex_codec(d)[0].decode('ascii')
     msg += ' ' + d
   log.info('{dflag} {msgcore}', dflag=dflag, msgcore=msg)
@@ -285,7 +286,8 @@ _crashing = False
 def crash(err):
   global _crashing
   _crashing = True
-  print('CRASH ', err, file=sys.stderr)
+  print('========== CRASH ==========', err,
+        '===========================', file=sys.stderr)
   try: reactor.stop()
   except twisted.internet.error.ReactorNotRunning: pass