Module logging

Module logging 

Source
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 logging
  • PRAX_DEBUG=1 - Enable debug logging
  • PRAX_LOG_LEVEL=debug|info|warn|error|trace - Set specific log level
  • PRAX_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_FORMAT environment variable.
get_log_level
Get the configured log level from PRAX_LOG_LEVEL environment 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_DEBUG environment variable.