Support the log level "CRITICAL"

"CRITICAL" is a valid Python log level [1]

We should support it or otherwise if we select to display the "ERROR"
log level we won't see the "CRITICAL" log level messages.

[1] https://docs.python.org/2.7/library/logging.html#logging-levels

Change-Id: Icdf8792dfa605c17f6186b53032ed103b3bfdd79
This commit is contained in:
John L. Villalovos 2017-10-04 16:22:36 -07:00
parent a0a4cadabd
commit 9dff1f2af9
5 changed files with 16 additions and 5 deletions

View File

@ -32,7 +32,7 @@ SUPPORTS_SEV = re.compile(
SYSLOGDATE = '\w+\s+\d+\s+\d{2}:\d{2}:\d{2}((\.|\,)\d{3,6})?'
DATEFMT = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}((\.|\,)\d{3,6})?'
STATUSFMT = '(DEBUG|INFO|WARNING|ERROR|TRACE|AUDIT)'
STATUSFMT = '(DEBUG|INFO|WARNING|ERROR|TRACE|AUDIT|CRITICAL)'
OSLO_LOGMATCH = '^(?P<date>%s)(?P<line>(?P<pid> \d+)? (?P<status>%s).*)' % \
(DATEFMT, STATUSFMT)
@ -56,7 +56,8 @@ SEVS = {
'AUDIT': 3,
'TRACE': 4,
'WARNING': 5,
'ERROR': 6
'ERROR': 6,
'CRITICAL': 7,
}

View File

@ -67,6 +67,11 @@ class TestFilters(base.TestCase):
self.assertIn("class='DEBUG", line)
self.assertIn("href='#_2013-09-27_18_22_11_249'", line)
# fourth is a CRITICAL
line = gen.next()
self.assertIn("class='CRITICAL", line)
self.assertIn("href='#_2013-09-27_18_22_11_249'", line)
def test_systemd_filters(self):
gen = self.get_generator('devstack@c-api.service.log.txt')
# dump the header

View File

@ -35,10 +35,12 @@ SEVS = {
'AUDIT': 3,
'TRACE': 4,
'WARNING': 5,
'ERROR': 6
'ERROR': 6,
'CRITICAL': 7,
}
SEVS_SEQ = ['NONE', 'DEBUG', 'INFO', 'AUDIT', 'TRACE', 'WARNING', 'ERROR']
SEVS_SEQ = ['NONE', 'DEBUG', 'INFO', 'AUDIT', 'TRACE', 'WARNING', 'ERROR',
'CRITICAL']
ISO8601RE = r'\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(.\d+)?'
TIME_REGEX = r'\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d(.\d+)?'
@ -96,12 +98,13 @@ class TestWsgiDisk(base.TestCase):
'ERROR': 5
},
'screen-q-svc.txt.gz': {
'DEBUG': 43584,
'DEBUG': 43583,
'INFO': 262,
'AUDIT': 0,
'TRACE': 589,
'WARNING': 48,
'ERROR': 72,
'CRITICAL': 1,
},
'screen-neutron-l3.txt.gz': {
'DEBUG': 25212,

View File

@ -27,6 +27,8 @@ a {color: #000; text-decoration: none}
a:hover {text-decoration: underline}
.DEBUG, .DEBUG a {color: #888}
.ERROR, .ERROR a {color: #c00; font-weight: bold}
.CRITICAL, .CRITICAL a {color: #c00; background-color: yellow;
font-weight: bold}
.TRACE, .TRACE a {color: #c60}
.WARNING, .WARNING a {color: #D89100; font-weight: bold}
.INFO, .INFO a {color: #006}