Skip to content

Commit

Permalink
Suppress Rust logging when off
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Nov 17, 2024
1 parent 984e323 commit 92acf5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/live/databento/databento_subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# InstrumentId.from_str("ES.FUT.GLBX"),
# InstrumentId.from_str("CL.FUT.GLBX"),
# InstrumentId.from_str("LO.OPT.GLBX"),
# InstrumentId.from_str("AAPL.XNAS"),
# InstrumentId.from_str("AAPL.IEXG"),
]

# Configure the trading node
Expand Down Expand Up @@ -171,7 +171,7 @@ def on_start(self) -> None:
# self.request_data(status_data_type, client_id=DATABENTO_CLIENT_ID)

# from nautilus_trader.model.data import BarType
# self.request_bars(BarType.from_str(f"{instrument_id}-1-MINUTE-LAST-EXTERNAL"))
# self.request_bars(BarType.from_str(f"{instrument_id}-1-SECOND-LAST-EXTERNAL"))

# # Imbalance
# from nautilus_trader.adapters.databento import DatabentoImbalance
Expand Down
5 changes: 5 additions & 0 deletions nautilus_trader/system/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import asyncio
import concurrent.futures
import os
import platform
import signal
import socket
Expand Down Expand Up @@ -170,6 +171,9 @@ def __init__( # noqa (too complex)
logging: LoggingConfig = config.logging or LoggingConfig()

if not is_logging_initialized():
if "RUST_LOG" not in os.environ:
os.environ["RUST_LOG"] = "off"

if not logging.bypass_logging:
if logging.clear_log_file and logging.log_directory and logging.log_file_name:
file_path = Path(
Expand All @@ -184,6 +188,7 @@ def __init__( # noqa (too complex)

if logging.use_pyo3:
set_logging_pyo3(True)

# Initialize tracing for async Rust
nautilus_pyo3.init_tracing()

Expand Down

0 comments on commit 92acf5c

Please sign in to comment.