| Total Complexity | 3 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 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 |