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 Aug 14, 2024
1 parent f4d72ad commit d81abd5
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 @@ -125,7 +125,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 @@ -146,7 +146,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 @@ -55,7 +55,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 @@ -64,7 +64,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 d81abd5

Please sign in to comment.