Ubuntu Pastebin

Paste from smoser at Tue, 28 Jul 2015 17:34:51 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/cloudinit/reporting.py b/cloudinit/reporting.py
index d2dd4fe..110a1e2 100644
--- a/cloudinit/reporting.py
+++ b/cloudinit/reporting.py
@@ -66,11 +66,14 @@ class ReportingHandler(object):
 class LogHandler(ReportingHandler):
     """Publishes events to the cloud-init log at the ``INFO`` log level."""
 
+    def __init__(self, *args, **kwargs):
+        super(LogHandler).__init__(*args, **kwargs)
+        self.logger = logging.getLogger(
+            '.'.join([__name__, event.event_type, event.name]))
+
     def publish_event(self, event):
         """Publish an event to the ``INFO`` log level."""
-        logger = logging.getLogger(
-            '.'.join([__name__, event.event_type, event.name]))
-        logger.info(event.as_string())
+        self.logger.info(event.as_string())
 
 
 def add_configuration(config):
Download as text