Expand description
Structured logging with JSON output and sensitive data masking.
Provides production-ready logging matching hyperi-pylib (Python) and hyperi-golib (Go). Automatically detects terminal vs container environment for format selection.
§Features
- RFC 3339 timestamps with timezone
- JSON output for containers, coloured text for terminals
- Sensitive data masking (passwords, tokens, API keys)
- Environment variable overrides (LOG_LEVEL, LOG_FORMAT, NO_COLOR)
§Example
use hyperi_rustlib::logger;
// Initialise with defaults (auto-detects format)
logger::setup_default().unwrap();
// Use tracing macros
tracing::info!(user_id = 123, "User logged in");
tracing::error!(error = "connection failed", "Database error");Re-exports§
pub use helpers::log_debounced;pub use helpers::log_sampled;pub use helpers::log_state_change;pub use security::SecurityEvent;pub use security::SecurityOutcome;
Modules§
- format
- Custom coloured log formatter for terminal output.
- helpers
- Log spam protection helpers.
- security
- Structured security event logging following OWASP Logging Vocabulary.
Structs§
- Logger
Options - Logger configuration options.
- Masking
Layer - Configuration for sensitive field detection.
- Masking
Writer - A writer that redacts sensitive field values from formatted log output.
- Throttle
Config - Log throttle configuration.
Enums§
- LogFormat
- Log output format.
- Logger
Error - Logger errors.
Functions§
- default_
sensitive_ fields - Default list of sensitive field names to mask.
- mask_
sensitive_ string - Mask sensitive values in a string.
- setup
- Initialise the global logger with custom options.
- setup_
default - Initialise the global logger with default settings.