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

plumd.plugins.writers.LogWriter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 11
Duplicated Lines 0 %
Metric Value
dl 0
loc 11
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A LogWriter.push() 0 8 3
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