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

exabgp.logger.history.history()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
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