Expand description
Logging and debugging utilities Logging and debugging utilities for the hyperliquid-backtester crate.
This module provides convenient functions for setting up structured logging and debugging support throughout the library.
§Basic Usage
use hyperliquid_backtest::logging::init_logger;
// Initialize with default settings (INFO level)
init_logger();
// Or with custom log level
init_logger_with_level("debug");
§Environment Variables
You can control logging behavior using environment variables:
RUST_LOG
: Set log level (e.g.,debug
,info
,warn
,error
)HYPERLIQUID_LOG_FORMAT
: Set format (json
orpretty
)HYPERLIQUID_LOG_FILE
: Write logs to file instead of stdout
§Examples
# Enable debug logging
RUST_LOG=debug cargo run --example basic_backtest
# Use JSON format for structured logging
RUST_LOG=info HYPERLIQUID_LOG_FORMAT=json cargo run
# Write logs to file
RUST_LOG=info HYPERLIQUID_LOG_FILE=backtest.log cargo run
Functions§
- init_
logger - Initialize the default logger with INFO level logging.
- init_
logger_ with_ level - Initialize the logger with a specific log level.
- init_
test_ logger - Initialize logger for testing with reduced verbosity.
- performance_
span - Create a tracing span for performance monitoring.