Commits

Ginés Martínez Sánchez  committed c2357eb Draft

improve logging system

  • Participants
  • Parent commits 5c22a6c

Comments (0)

Files changed (4)

File ginsfsm/examples/essential_gobjs/ongsock.py

 
 """
 
+import logging
+logging.basicConfig(level=logging.DEBUG)
+
 from ginsfsm.gobj import GObj
 from ginsfsm.gaplic import GAplic
 from ginsfsm.c_timer import GTimer
 from ginsfsm.utils import hexdump
 from ginsfsm.compat import bytes_
 
-import logging
-logging.basicConfig(level=logging.DEBUG)
-
 QUERY = "GET / HTTP/1.1\r\n" + \
     "Host: %s\r\n" + \
     "\r\n"

File ginsfsm/examples/router/test_router.py

     and so on.
 
 """
+import logging
+logging.basicConfig(level=logging.DEBUG)
 
 from ginsfsm.gaplic import GAplic
 from ginsfsm.c_timer import GTimer
         'gaplic-name': 'TOTO',
         'router_enabled': True,
         'GRouter.server': True,
-        'GRouter.trace_router': True,
+        'GRouter.trace_router': False,
         'GRouter.localhost_route_ports': 8000,
-        'GSock.trace_dump': True,
+        'GSock.trace_dump': False,
         'GObj.trace_mach': False,
         'GObj.logger': logging,
     }
         'gaplic-name': 'TITI',
         'router_enabled': True,
         'GRouter.server': False,
-        'GRouter.trace_router': True,
+        'GRouter.trace_router': False,
         'GRouter.static_routes': 'TOTO, toto, http://localhost:8000',
-        'GSock.trace_dump': True,
+        'GSock.trace_dump': False,
         'GObj.trace_mach': False,
         'GObj.logger': logging,
     }

File ginsfsm/examples/sockjs/test_sockjs_server.ini

 handlers = console
 
 [logger_ginsfsm]
-level = WARN
+level = INFO
 handlers =
 qualname = ginsfsm
 

File ginsfsm/gobj.py

         self._destroyed = False  # mark as destroyed when destroy_gobj()
         self._re_compiled_name = ''  # re compiled name when using re_name
         self.re_matched_name = ''  # matched name when using re_name
-
+        self.trace_creation = False
         gconfig = add_gconfig(gconfig, GOBJ_GCONFIG)
         GConfig.__init__(self, gconfig, self.logger)
 
     def destroy_gobj(gobj):
         """ Destroy a gobj
         """
-        if gobj.config.trace_creation and gobj.logger:
+        if gobj.trace_creation and gobj.logger:
             gobj.logger.info("Destroying --> %r" % (gobj))
 
         if gobj._destroyed: