From dd5afdb6863d8e8e1a1cdfcd2ce5fe06bc45bc95 Mon Sep 17 00:00:00 2001 From: zheng yin Date: Fri, 29 Jul 2016 12:12:55 +0800 Subject: [PATCH] simple log information When it has the same log information, we can use a function to simple it, then it also improve code readability. Change-Id: I5bb901099dcc832fc0651b34707901849abb0c34 --- swift/obj/replicator.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index d5b3580a54..9976b54452 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -201,12 +201,9 @@ class ObjectReplicator(Daemon): if self.rsync_error_log_line_length: error_line = error_line[:self.rsync_error_log_line_length] self.logger.error(error_line) - elif results: - self.logger.info( - _("Successful rsync of %(src)s at %(dst)s (%(time).03f)"), - {'src': args[-2], 'dst': args[-1], 'time': total_time}) else: - self.logger.debug( + log_method = self.logger.info if results else self.logger.debug + log_method( _("Successful rsync of %(src)s at %(dst)s (%(time).03f)"), {'src': args[-2], 'dst': args[-1], 'time': total_time}) return ret_val