Browse Source

Add logger to Proxy object

It's good to be able to easily log things. Add a logger of the form
openstack.{service-type}. This will allow conceptual filtering
without too much heartburn.

Change-Id: I091cb0997eec47d995b6522a57030005ca224cbb
Monty Taylor 1 week ago
parent
commit
5c06d139c2
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      openstack/proxy.py

+ 6
- 0
openstack/proxy.py View File

@@ -19,6 +19,7 @@ from six.moves import urllib
19 19
 
20 20
 from keystoneauth1 import adapter
21 21
 
22
+from openstack import _log
22 23
 from openstack import exceptions
23 24
 from openstack import resource
24 25
 
@@ -135,6 +136,11 @@ class Proxy(adapter.Adapter):
135 136
         self._statsd_prefix = statsd_prefix
136 137
         self._prometheus_counter = prometheus_counter
137 138
         self._prometheus_histogram = prometheus_histogram
139
+        if self.service_type:
140
+            log_name = 'openstack.{0}'.format(self.service_type)
141
+        else:
142
+            log_name = 'openstack'
143
+        self.log = _log.setup_logging(log_name)
138 144
 
139 145
     def request(
140 146
             self, url, method, error_message=None,

Loading…
Cancel
Save