Skip to content

Commit 3adfc5b

Browse files
author
alexandr
committed
RPPT-001 | Move loglevel map from __init__
1 parent 5a7bd63 commit 3adfc5b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pytest_reportportal/rp_logging.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ def _log(self, level, msg, args,
3737

3838

3939
class RPLogHandler(logging.Handler):
40+
# Map loglevel codes from `logging` module to ReportPortal text names:
41+
_loglevel_map = {
42+
logging.NOTSET: 'TRACE',
43+
logging.DEBUG: 'DEBUG',
44+
logging.INFO: 'INFO',
45+
logging.WARNING: 'WARN',
46+
logging.ERROR: 'ERROR',
47+
logging.CRITICAL: 'ERROR',
48+
}
49+
_sorted_levelnos = sorted(_loglevel_map.keys(), reverse=True)
50+
4051
def __init__(self, level=logging.NOTSET):
4152
super(RPLogHandler, self).__init__(level)
4253

43-
# Map loglevel codes from `logging` module to ReportPortal text names:
44-
self._loglevel_map = {
45-
logging.NOTSET: 'TRACE',
46-
logging.DEBUG: 'DEBUG',
47-
logging.INFO: 'INFO',
48-
logging.WARNING: 'WARN',
49-
logging.ERROR: 'ERROR',
50-
logging.CRITICAL: 'ERROR',
51-
}
52-
self._sorted_levelnos = sorted(self._loglevel_map.keys(), reverse=True)
53-
5454
def emit(self, record):
5555
msg = ''
5656

0 commit comments

Comments
 (0)