diff --git a/aossceilo/ingest.py b/aossceilo/ingest.py index 697b1d7afd80ee533a92db999aa78e7880d13a74..61a3e659980b1d67fba5aec1c22344d3f25df339 100755 --- a/aossceilo/ingest.py +++ b/aossceilo/ingest.py @@ -36,9 +36,14 @@ from datetime import datetime, timedelta import serial -# FIXME: bad-joo-joo -logging._levelNames[9] = 'TRACE' -logging._levelNames['TRACE'] = 9 +# https://stackoverflow.com/a/13638084/433202 +TRACE_LEVEL_NUM = 9 +logging.addLevelName(TRACE_LEVEL_NUM, "TRACE") +def debugv(self, message, *args, **kws): + # Yes, logger takes its '*args' as 'args'. + if self.isEnabledFor(TRACE_LEVEL_NUM): + self._log(TRACE_LEVEL_NUM, message, args, **kws) +logging.Logger.debugv = debugv LOG = logging.getLogger(__name__)