From 0a8dac38ac4415ea770fb36b34e3c494e8713e6e Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 15 Jun 2017 18:09:36 +0530 Subject: geo-rep: Structured log support Changed all log messages to structured log format Change-Id: Idae25f8b4ad0bbae38f4362cbda7bbf51ce7607b Updates: #240 Signed-off-by: Aravinda VK Reviewed-on: https://review.gluster.org/17551 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kotresh HR --- geo-replication/syncdaemon/gsyncdstatus.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'geo-replication/syncdaemon/gsyncdstatus.py') diff --git a/geo-replication/syncdaemon/gsyncdstatus.py b/geo-replication/syncdaemon/gsyncdstatus.py index dd363baf181..38ca92c73a9 100644 --- a/geo-replication/syncdaemon/gsyncdstatus.py +++ b/geo-replication/syncdaemon/gsyncdstatus.py @@ -20,7 +20,7 @@ from errno import EACCES, EAGAIN, ENOENT import logging from syncdutils import EVENT_GEOREP_ACTIVE, EVENT_GEOREP_PASSIVE, gf_event -from syncdutils import EVENT_GEOREP_CHECKPOINT_COMPLETED +from syncdutils import EVENT_GEOREP_CHECKPOINT_COMPLETED, lf DEFAULT_STATUS = "N/A" MONITOR_STATUS = ("Created", "Started", "Paused", "Stopped") @@ -225,10 +225,10 @@ class GeorepStatus(object): data["checkpoint_time"] = checkpoint_time data["checkpoint_completion_time"] = curr_time data["checkpoint_completed"] = "Yes" - logging.info("Checkpoint completed. Checkpoint " - "Time: %s, Completion Time: %s" % ( - human_time_utc(checkpoint_time), - human_time_utc(curr_time))) + logging.info(lf("Checkpoint completed", + checkpoint_time=human_time_utc( + checkpoint_time), + completion_time=human_time_utc(curr_time))) self.trigger_gf_event_checkpoint_completion( checkpoint_time, curr_time) @@ -238,11 +238,13 @@ class GeorepStatus(object): def set_worker_status(self, status): if self.set_field("worker_status", status): - logging.info("Worker Status: %s" % status) + logging.info(lf("Worker Status Change", + status=status)) def set_worker_crawl_status(self, status): if self.set_field("crawl_status", status): - logging.info("Crawl Status: %s" % status) + logging.info(lf("Crawl Status Change", + status=status)) def set_slave_node(self, slave_node): def merger(data): @@ -269,12 +271,14 @@ class GeorepStatus(object): def set_active(self): if self.set_field("worker_status", "Active"): - logging.info("Worker Status: Active") + logging.info(lf("Worker Status Change", + status="Active")) self.send_event(EVENT_GEOREP_ACTIVE) def set_passive(self): if self.set_field("worker_status", "Passive"): - logging.info("Worker Status: Passive") + logging.info(lf("Worker Status Change", + status="Passive")) self.send_event(EVENT_GEOREP_PASSIVE) def get_monitor_status(self): -- cgit