[sonic_platform] Correct the wrong log identifiers (#3596)

This commit is contained in:
Stephen Sun 2019-10-16 02:29:45 +08:00 committed by Joe LeVeque
parent 34d8842fbd
commit aea09ba1da
6 changed files with 10 additions and 13 deletions

View File

@ -39,8 +39,7 @@ REBOOT_CAUSE_ROOT = HWMGMT_SYSTEM_ROOT
REBOOT_CAUSE_FILE_LENGTH = 1
# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-chassis-api"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()
# magic code defnition for port number, qsfp port position of each hwsku
# port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET)

View File

@ -17,8 +17,7 @@ except ImportError as e:
raise ImportError (str(e) + "- required module not found")
# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-psu-api"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()
psu_list = []

View File

@ -188,8 +188,7 @@ PORT_TYPE_MASK = 0xF0000000
NVE_MASK = PORT_TYPE_MASK & (PORT_TYPE_NVE << PORT_TYPE_OFFSET)
# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-sfp"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()
class SFP(SfpBase):
"""Platform-specific SFP class"""

View File

@ -11,8 +11,6 @@ import select
from python_sdk_api.sx_api import *
from sonic_daemon_base.daemon_base import Logger
SYSLOG_IDENTIFIER = "sfp-event"
SDK_SFP_STATE_IN = 0x1
SDK_SFP_STATE_OUT = 0x2
STATUS_PLUGIN = '1'
@ -34,7 +32,7 @@ SDK_DAEMON_READY_FILE = '/tmp/sdk_ready'
PMPE_PACKET_SIZE = 2000
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()
class sfp_event:
''' Listen to plugin/plugout cable events '''

View File

@ -19,8 +19,7 @@ except ImportError as e:
raise ImportError (str(e) + "- required module not found")
# Global logger class instance
SYSLOG_IDENTIFIER = "mlnx-thermal-api"
logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()
THERMAL_DEV_CATEGORY_CPU_CORE = "cpu_core"
THERMAL_DEV_CATEGORY_CPU_PACK = "cpu_pack"

View File

@ -48,9 +48,12 @@ def db_connect(db):
#
class Logger(object):
def __init__(self, syslog_identifier):
def __init__(self, syslog_identifier = None):
self.syslog = syslog
self.syslog.openlog(ident=syslog_identifier, logoption=self.syslog.LOG_NDELAY, facility=self.syslog.LOG_DAEMON)
if syslog_identifier is None:
self.syslog.openlog()
else:
self.syslog.openlog(ident=syslog_identifier, logoption=self.syslog.LOG_NDELAY, facility=self.syslog.LOG_DAEMON)
def __del__(self):
self.syslog.closelog()