Expand description
Logging infrastructure for sqlmodel-console.
This module provides lightweight logging support for debugging console operations without requiring external dependencies. Logging can be enabled via environment variables.
§Environment Variables
SQLMODEL_LOG=1- Enable logging outputSQLMODEL_LOG_LEVEL=debug|info|warn|error- Set minimum log level
§Usage
ⓘ
use sqlmodel_console::logging::{log_debug, log_info};
log_info!("Initializing console");
log_debug!("Mode detected: {}", mode);In tests, use with_logging_enabled to capture logs:
ⓘ
use sqlmodel_console::logging::with_logging_enabled;
with_logging_enabled(|| {
// Your code here - logs will be printed to stderr
});Macros§
- log_
debug - Log a debug message.
- log_
error - Log an error message.
- log_
info - Log an info message.
- log_
trace - Log a trace message.
- log_
warn - Log a warning message.
Enums§
- LogLevel
- Log levels for console operations.
Functions§
- disable_
logging - Disable logging programmatically.
- enable_
logging - Enable logging programmatically (useful for tests).
- init_
logging - Initialize logging from environment variables.
- is_
logging_ enabled - Check if logging is enabled.
- min_
log_ level - Get the current minimum log level.
- set_
log_ level - Set the minimum log level programmatically.
- with_
logging_ enabled - Run a closure with logging enabled, then restore previous state.