Skip to content

Commit

Permalink
[xcvrd] Use new logger implementation and enable runtime log level co…
Browse files Browse the repository at this point in the history
…nfiguration
  • Loading branch information
Junchao-Mellanox committed Jun 24, 2024
1 parent 6694d3b commit 78cc47d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import ctypes

from natsort import natsorted
from sonic_py_common import daemon_base, device_info, logger
from sonic_py_common import daemon_base, syslogger
from sonic_py_common import multi_asic
from swsscommon import swsscommon

Expand Down Expand Up @@ -116,7 +116,7 @@
# Global logger instance for helper functions and classes
# TODO: Refactor so that we only need the logger inherited
# by DaemonXcvrd
helper_logger = logger.Logger(SYSLOG_IDENTIFIER)
helper_logger = syslogger.SysLogger(SYSLOG_IDENTIFIER, enable_runtime_config=True)

#
# Helper functions =============================================================
Expand Down Expand Up @@ -2388,7 +2388,7 @@ def retry_eeprom_reading(self):

class DaemonXcvrd(daemon_base.DaemonBase):
def __init__(self, log_identifier, skip_cmis_mgr=False, enable_sff_mgr=False):
super(DaemonXcvrd, self).__init__(log_identifier)
super(DaemonXcvrd, self).__init__(log_identifier, enable_runtime_log_config=True)
self.stop_event = threading.Event()
self.sfp_error_event = threading.Event()
self.skip_cmis_mgr = skip_cmis_mgr
Expand All @@ -2399,7 +2399,8 @@ def __init__(self, log_identifier, skip_cmis_mgr=False, enable_sff_mgr=False):
# Signal handler
def signal_handler(self, sig, frame):
if sig == signal.SIGHUP:
self.log_info("Caught SIGHUP - ignoring...")
self.log_notice("Caught SIGHUP...")
syslogger.SysLogger.refresh_config()
elif sig == signal.SIGINT:
self.log_info("Caught SIGINT - exiting...")
self.stop_event.set()
Expand Down
4 changes: 2 additions & 2 deletions sonic-xcvrd/xcvrd/xcvrd_utilities/media_settings_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import ast

from sonic_py_common import device_info, logger
from sonic_py_common import device_info, syslogger
from swsscommon import swsscommon
from xcvrd import xcvrd

Expand All @@ -17,7 +17,7 @@
MEDIA_KEY = 'media_key'
LANE_SPEED_KEY = 'lane_speed_key'
SYSLOG_IDENTIFIER = "xcvrd"
helper_logger = logger.Logger(SYSLOG_IDENTIFIER)
helper_logger = syslogger.SysLogger(SYSLOG_IDENTIFIER, enable_runtime_config=True)


def load_media_settings():
Expand Down
4 changes: 2 additions & 2 deletions sonic-xcvrd/xcvrd/xcvrd_utilities/optics_si_parser.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import json
import os

from sonic_py_common import device_info, logger
from sonic_py_common import device_info, syslogger
from xcvrd import xcvrd

g_optics_si_dict = {}

SYSLOG_IDENTIFIER = "xcvrd"
helper_logger = logger.Logger(SYSLOG_IDENTIFIER)
helper_logger = syslogger.SysLogger(SYSLOG_IDENTIFIER, enable_runtime_config=True)

def get_optics_si_settings_value(physical_port, lane_speed, key, vendor_name_str):
GLOBAL_MEDIA_SETTINGS_KEY = 'GLOBAL_MEDIA_SETTINGS'
Expand Down

0 comments on commit 78cc47d

Please sign in to comment.