Skip to content

Commit

Permalink
[sonic_platform] Correct the wrong log identifiers (#3596)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenxs authored and jleveque committed Oct 15, 2019
1 parent 34d8842 commit aea09ba
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
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)
Expand Down
3 changes: 1 addition & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
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 = []

Expand Down
3 changes: 1 addition & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@
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"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
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'
Expand All @@ -34,7 +32,7 @@

PMPE_PACKET_SIZE = 2000

logger = Logger(SYSLOG_IDENTIFIER)
logger = Logger()

class sfp_event:
''' Listen to plugin/plugout cable events '''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
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"
Expand Down
7 changes: 5 additions & 2 deletions src/sonic-daemon-base/sonic_daemon_base/daemon_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit aea09ba

Please sign in to comment.