Expand description
§Charmed Log
A structured logging library designed for terminal applications.
Charmed Log provides beautiful, structured logging output with support for:
- Multiple log levels (trace, debug, info, warn, error, fatal)
- Structured key-value pairs
- Multiple output formatters (text, JSON, logfmt)
- Integration with lipgloss for styled output
§Role in charmed_rust
Charmed Log is the logging spine for TUI applications in this repo:
- wish uses it for SSH session logging and diagnostics.
- demo_showcase uses it for traceable, styled logs in tests and demos.
- lipgloss supplies the styling used in human-readable formatters.
§Example
use charmed_log::{Logger, Level};
let logger = Logger::new();
logger.info("Application started", &[("version", "1.0.0")]);§Formatters
- Text: Human-readable colored output (default)
- JSON: Machine-readable JSON output
- Logfmt: Key=value format for log aggregation
Modules§
Structs§
- Caller
Info - Caller information extracted from the call stack.
- Logger
- A structured logger instance.
- Options
- Logger options.
- Parse
Level Error - Error returned when parsing an invalid log level string.
- Styles
- Styles for the text formatter.
Enums§
Constants§
- DEFAULT_
TIME_ FORMAT - Default time format.
Functions§
- long_
caller_ formatter - Long caller formatter - returns full path and line.
- now_utc
- Returns the time in UTC.
- short_
caller_ formatter - Short caller formatter - returns last 2 path segments and line.
Type Aliases§
- Caller
Formatter - Type alias for caller formatter.
- Error
Handler - Type alias for error handler callback.
- Parse
Result - A specialized
Resulttype for level parsing operations. - Time
Function - Type alias for time function.