Completed
Push — master ( da3b73...3279ec )
by Kenny
01:17
created

LogWriter.push()   A

Complexity

Conditions 3

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 1
Metric Value
cc 3
c 2
b 2
f 1
dl 0
loc 8
rs 9.4285
1
# -*- coding: utf-8 -*-
2
3
__author__ = 'Kenny Freeman'
4
__email__ = '[email protected]'
5
__license__ = "ISCL"
6
__docformat__ = 'reStructuredText'
7
8
import random
9
import time
10
import sys
11
import os.path
12
13
import plumd.plugins
14
15
16
class LogWriter(plumd.plugins.Writer):
17
    """Simply logs all metrics received."""
18
19
    def push(self, rset):
20
        """Simply logs the metrics."""
21
        # ( time, result_name, result_meta, [metric, metric, metric] )
22
        for (ts, rname, rmeta, metrics) in rset.results:
23
            for metric in metrics:
24
                msg = "test: received: measurement: {0}, time: {1}, name:{2}, value: {3}, meta: {4}"
25
                self.log.debug(msg.format(rname, ts, metric.name, metric.value,
26
                                          rmeta))
27