[write_standby]: Improve logging
Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
This commit is contained in:
parent
fad5ec47b4
commit
69bae5b27a
@ -2,11 +2,11 @@
|
||||
|
||||
import time
|
||||
|
||||
from sonic_py_common import logger as log
|
||||
from swsscommon.swsscommon import ConfigDBConnector, DBConnector, FieldValuePairs, ProducerStateTable, SonicV2Connector
|
||||
from swsscommon.swsscommon import APPL_DB
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
logger = log.Logger('write_standby')
|
||||
|
||||
REDIS_SOCK_PATH = '/var/run/redis/redis.sock'
|
||||
|
||||
@ -86,7 +86,7 @@ class MuxStateWriter(object):
|
||||
(bool) True if the tunnel has been created
|
||||
False if the timeout period is exceeded
|
||||
"""
|
||||
logger.info("Waiting for tunnel {} with timeout {} seconds".format(self.tunnel_name, timeout))
|
||||
logger.log_info("Waiting for tunnel {} with timeout {} seconds".format(self.tunnel_name, timeout))
|
||||
start = time.time()
|
||||
curr_time = time.time()
|
||||
|
||||
@ -105,14 +105,14 @@ class MuxStateWriter(object):
|
||||
intfs = self.get_all_mux_intfs()
|
||||
state = 'standby'
|
||||
if self.wait_for_tunnel():
|
||||
logger.warning("Applying {} state to interfaces {}".format(state, intfs))
|
||||
logger.log_warning("Applying {} state to interfaces {}".format(state, intfs))
|
||||
producer_state_table = ProducerStateTable(self.appl_db, 'MUX_CABLE_TABLE')
|
||||
fvs = create_fvs(state=state)
|
||||
|
||||
for intf in intfs:
|
||||
producer_state_table.set(intf, fvs)
|
||||
else:
|
||||
logger.error("Timed out waiting for tunnel {}, mux state will not be written".format(self.tunnel_name))
|
||||
logger.log_error("Timed out waiting for tunnel {}, mux state will not be written".format(self.tunnel_name))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user