less print() statements
paulfantom committed
Jun 23, 2016 at 11:26 UTC
6a509059e5f5896e5ebc697cabb665052a8b8360
1 file changed
+8
-3
python.d/python_modules/base.py
+8
-3
@@ -229,6 +229,7 @@ class UrlService(BaseService):
229
data = self._formatted_data()
230
if data is None:
231
return False
232
+ data_stream = ""
233
for name in self.order:
234
header = "CHART " + \
235
self.__module__ + "_" + \
@@ -241,12 +242,14 @@ class UrlService(BaseService):
242
# check if server has this datapoint
243
for line in self.charts[name]['lines']:
244
if line['name'] in data:
244
- content += "DIMENSION " + line['name'] + " " + line['options'] + "\n"
245
+ content += "\nDIMENSION " + line['name'] + " " + line['options']
246
247
if len(content) > 0:
247
- print(header + "\n" + content)
248
+ data_stream += header + content + "\n"
249
idx += 1
250
251
+ print(data_stream)
252
+
253
if idx == 0:
254
return False
255
return True
@@ -261,6 +264,7 @@ class UrlService(BaseService):
264
if data is None:
265
return False
266
267
+ data_stream = ""
268
for chart, dimensions in self.definitions.items():
269
header = "BEGIN " + self.__module__ + "_" + str(self.name) + "." + chart + " " + str(interval)
270
c = ""
@@ -270,6 +274,7 @@ class UrlService(BaseService):
274
except KeyError:
275
pass
276
if len(c) != 0:
273
- print(header + c + "\nEND")
277
+ data_stream += header + c + "\nEND\n"
278
+ print(data_stream)
279
280
return True