Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Junchao-Mellanox committed Jul 31, 2024
1 parent e954faf commit 3f0f5b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/sonic-py-common/sonic_py_common/syslogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def log_priority_to_str(self, priority):
return 'ERROR'
else:
self.log_error(f'Invalid log priority: {priority}')
return 'NOTICE'
return 'WARN'

def log_priority_from_str(self, priority_in_str):
"""Convert log priority from string.
Expand All @@ -140,7 +140,7 @@ def log_priority_from_str(self, priority_in_str):
return logging.ERROR
else:
self.log_error(f'Invalid log priority string: {priority_in_str}')
return logging.NOTICE
return logging.WARNING

def set_min_log_priority(self, priority):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sonic-py-common/tests/test_syslogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_log_priority_from_str(self):
assert log.log_priority_from_str('NOTICE') == logging.NOTICE
assert log.log_priority_from_str('WARN') == logging.WARN
assert log.log_priority_from_str('DEBUG') == logging.DEBUG
assert log.log_priority_from_str('invalid') == logging.NOTICE
assert log.log_priority_from_str('invalid') == logging.WARN

def test_log_priority_to_str(self):
log = syslogger.SysLogger()
Expand All @@ -46,7 +46,7 @@ def test_log_priority_to_str(self):
assert log.log_priority_to_str(logging.DEBUG) == 'DEBUG'
assert log.log_priority_to_str(logging.WARN) == 'WARN'
assert log.log_priority_to_str(logging.ERROR) == 'ERROR'
assert log.log_priority_to_str(-1) == 'NOTICE'
assert log.log_priority_to_str(-1) == 'WARN'

@mock.patch('swsscommon.swsscommon.SonicV2Connector')
def test_runtime_config(self, mock_connector):
Expand Down

0 comments on commit 3f0f5b9

Please sign in to comment.