Skip to content

Commit 0ffaf07

Browse files
committed
MOD: Reduce log level of SystemMsg
1 parent e0a0599 commit 0ffaf07

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
- Added `ts_index` and `pretty_ts_index` properties for records in Python which provides the timestamp that is most appropriate for indexing
1313
- Fixed type stub for `channel_id` to allow None
1414

15+
#### Enhancements
16+
- Reduced the log level of `SystemMsg` records in the `Live` client to debug
17+
- Increased the log level of `SystemMsg` records with the code `SystemCode.SLOW_READER_WARNING` to warning
18+
1519
#### Bug fixes
1620
- Fixed type hint for `start` parameter in `Live.subscribe()`
1721

databento/live/protocol.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
from typing import Final
88

99
import databento_dbn
10+
from databento_dbn import DBNError
1011
from databento_dbn import Metadata
1112
from databento_dbn import Schema
1213
from databento_dbn import SType
14+
from databento_dbn import SystemCode
1315
from databento_dbn import VersionUpgradePolicy
1416

1517
from databento.common import cram
@@ -380,10 +382,19 @@ def _process_dbn(self, data: bytes) -> None:
380382
if record.is_heartbeat():
381383
logger.debug("gateway heartbeat")
382384
else:
383-
logger.info(
384-
"gateway message: %s",
385-
record.msg,
386-
)
385+
try:
386+
msg_code = record.code
387+
except DBNError:
388+
msg_code = None
389+
if msg_code == SystemCode.SLOW_READER_WARNING:
390+
logger.warning(
391+
record.msg,
392+
)
393+
else:
394+
logger.debug(
395+
"gateway message: %s",
396+
record.msg,
397+
)
387398
self.received_record(record)
388399

389400
def _process_gateway(self, data: bytes) -> None:

0 commit comments

Comments
 (0)