Completed
Push — master ( 12c888...988ad6 )
by Thomas
11:22
created

exabgp.logger.history   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 3

2 Functions

Rating   Name   Duplication   Size   Complexity  
A history() 0 2 1
A record() 0 4 2
1
from collections import deque
2
3
from exabgp.logger.format import _long_color_formater as formater
4
5
_history = deque()
6
_max_history = 20
7
8
9
def history():
10
    return "\n".join(formater(*_) for _ in _history)
11
12
13
def record(message, source, level, timestamp):
14
    if len(_history) > _max_history:
15
        _history.popleft()
16
    _history.append((message, source, level, timestamp))
17