Expand description
Logging infrastructure for Prax ORM.
This module provides structured JSON logging controlled by the PRAX_DEBUG environment variable.
§Environment Variables
PRAX_DEBUG=true- Enable debug loggingPRAX_DEBUG=1- Enable debug loggingPRAX_LOG_LEVEL=debug|info|warn|error|trace- Set specific log levelPRAX_LOG_FORMAT=json|pretty|compact- Set output format (default: json)
§Usage
use prax_query::logging;
// Initialize logging (call once at startup)
logging::init();
// Or with custom settings
logging::init_with_level("debug");§Internal Logging
Within Prax, use the standard tracing macros:
ⓘ
use tracing::{debug, info, warn, error, trace};
debug!(filter = ?filter, "Building SQL for filter");
info!(table = %table, "Executing query");
warn!(latency_ms = %ms, "Slow query detected");
error!(error = %e, "Query failed");Functions§
- get_
log_ format - Get the configured log format from
PRAX_LOG_FORMATenvironment variable. - get_
log_ level - Get the configured log level from
PRAX_LOG_LEVELenvironment variable. - init
- Initialize the Prax logging system.
- init_
debug - Initialize logging for debugging (convenience function).
- init_
with_ level - Initialize logging with a specific level.
- is_
debug_ enabled - Check if debug logging is enabled via
PRAX_DEBUGenvironment variable.