Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xcvrd][thermalctld] Add logger instances for helper functions and classes #82

Merged
merged 3 commits into from
Aug 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions sonic-thermalctld/scripts/thermalctld
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ class ThermalMonitor(ProcessTaskBase):
:param chassis: Object representing a platform chassis
"""
ProcessTaskBase.__init__(self)

# TODO: Refactor to eliminate the need for this Logger instance
self.logger = logger.Logger(SYSLOG_IDENTIFIER)
self.fan_updater = FanUpdater(SYSLOG_IDENTIFIER, chassis)
self.temperature_updater = TemperatureUpdater(SYSLOG_IDENTIFIER, chassis)

Expand All @@ -574,7 +577,7 @@ class ThermalMonitor(ProcessTaskBase):
Thread function to handle Fan status update and temperature status update
:return:
"""
self.log_info("Start thermal monitoring loop")
self.logger.log_info("Start thermal monitoring loop")

# Start loop to update fan, temperature info in DB periodically
wait_time = ThermalMonitor.INITIAL_INTERVAL
Expand All @@ -589,13 +592,13 @@ class ThermalMonitor(ProcessTaskBase):
wait_time = ThermalMonitor.INITIAL_INTERVAL

if elapse > ThermalMonitor.UPDATE_ELAPSE_THRESHOLD:
self.log_warning('Update fan and temperature status takes {} seconds, '
'there might be performance risk'.format(elapse))
self.logger.log_warning('Update fan and temperature status takes {} seconds, '
'there might be performance risk'.format(elapse))

self.fan_updater.deinit()
self.temperature_updater.deinit()

self.log_info("Stop thermal monitoring loop")
self.logger.log_info("Stop thermal monitoring loop")


#
Expand Down
Loading