Commit 67b2dd29 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Make logger (almost) a no-op by default.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1948 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6b5e5d58
...@@ -21,13 +21,14 @@ from neo.util import dump ...@@ -21,13 +21,14 @@ from neo.util import dump
from neo.handler import EventHandler from neo.handler import EventHandler
from neo.profiling import profiler_decorator from neo.profiling import profiler_decorator
LOGGER_ENABLED = False
class PacketLogger(EventHandler): class PacketLogger(EventHandler):
""" Logger at packet level (for debugging purpose) """ """ Logger at packet level (for debugging purpose) """
def __init__(self): def __init__(self):
EventHandler.__init__(self, None) EventHandler.__init__(self, None)
@profiler_decorator
def dispatch(self, conn, packet, direction): def dispatch(self, conn, packet, direction):
"""This is a helper method to handle various packet types.""" """This is a helper method to handle various packet types."""
# default log message # default log message
...@@ -257,3 +258,6 @@ class PacketLogger(EventHandler): ...@@ -257,3 +258,6 @@ class PacketLogger(EventHandler):
PACKET_LOGGER = PacketLogger() PACKET_LOGGER = PacketLogger()
if not LOGGER_ENABLED:
# disable logger
PACKET_LOGGER.dispatch = lambda *args, **kw: 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