Add TRACE log level
This is useful for when we want important debug messages, but not necessarily to be flooded with every message that comes through IRC Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -8,6 +8,20 @@ import sys
|
||||
from .config import ServerConfig
|
||||
from .bot import Bot
|
||||
|
||||
# ADD TRACE
|
||||
# add TRACE logging level to logging module
|
||||
TRACE = 5
|
||||
logging.addLevelName(TRACE, "TRACE")
|
||||
logging.TRACE = TRACE
|
||||
|
||||
def trace(self, message, *args, **kwargs):
|
||||
if self.isEnabledFor(TRACE):
|
||||
#args = list(map(str, args))
|
||||
self._log(TRACE, message, args, **kwargs)
|
||||
|
||||
logging.Logger.trace = trace
|
||||
# END ADD TRACE
|
||||
|
||||
parser = argparse.ArgumentParser(description="Run an IRC bot")
|
||||
parser.add_argument("-c", "--config", type=str, default=None)
|
||||
parser.add_argument(
|
||||
|
||||
Reference in New Issue
Block a user