Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/galaxy/util/custom_logging/__init__.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 import logging | |
2 import types | |
3 | |
4 | |
5 class TraceLogger: | |
6 | |
7 def __init__(self, name): | |
8 self.name = name | |
9 | |
10 def log(**kwargs): | |
11 raise TypeError("Abstract Method") | |
12 | |
13 | |
14 # Add custom "TRACE" log level for ludicrous verbosity. | |
15 LOGLV_TRACE = 5 | |
16 logging.addLevelName(LOGLV_TRACE, "TRACE") | |
17 | |
18 | |
19 def trace(self, message, *args, **kws): | |
20 if self.isEnabledFor(LOGLV_TRACE): | |
21 self._log(LOGLV_TRACE, message, args, **kws) | |
22 | |
23 | |
24 def get_logger(name=None): | |
25 logger = logging.getLogger(name) | |
26 logger.trace = types.MethodType(trace, logger) | |
27 return logger |