From e42ff5e5ca8c0d72802b5ad8ae7867c2f5ae2fac Mon Sep 17 00:00:00 2001 From: Markus Zoeller Date: Fri, 8 Apr 2016 15:19:59 +0200 Subject: Add "__repr__" method to class "Service" The class "Service" doesn't have a "__repr__" method which results in log outputs like: DEBUG [...] service = This is not helpful when analyzing logs. Therefore this change adds a "__repr__" method. Change-Id: I49c8b7f0dde298de780808c988e4b50278eed665 --- nova/service.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nova/service.py') diff --git a/nova/service.py b/nova/service.py index dc40de4a0c..9810ce275d 100644 --- a/nova/service.py +++ b/nova/service.py @@ -110,6 +110,15 @@ class Service(service.Service): self.conductor_api = conductor.API(use_local=db_allowed) self.conductor_api.wait_until_ready(context.get_admin_context()) + def __repr__(self): + return "<%(cls_name)s: host=%(host)s, binary=%(binary)s, " \ + "manager_class_name=%(manager)s>" % { + 'cls_name': self.__class__.__name__, + 'host': self.host, + 'binary': self.binary, + 'manager': self.manager_class_name + } + def start(self): verstr = version.version_string_with_package() LOG.info(_LI('Starting %(topic)s node (version %(version)s)'), -- cgit v1.2.1