-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
24 lines (18 loc) · 903 Bytes
/
Copy pathlogger.py
File metadata and controls
24 lines (18 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""stdlib stand-in for the private project's `logger` module.
The private trading project wires health events into its monitoring stack.
For the public stream only the call surface matters: log_health_event(event,
detail). This shim records events in a bounded in-memory ring (tests and
operators can inspect it) and forwards them to stdlib logging.
"""
from __future__ import annotations
import logging
import time
from collections import deque
_logger = logging.getLogger("kucoin_fast_stream.health")
_logger.addHandler(logging.NullHandler())
# Bounded ring of recent health events: (unix_ts, event, detail). Tests assert
# against it; a live operator can `import logger; logger.events` to inspect.
events: deque = deque(maxlen=1000)
def log_health_event(event: str, detail: str = "") -> None:
events.append((time.time(), str(event), str(detail)))
_logger.info("%s | %s", event, detail)