Crate pretint

Crate pretint 

Source
Expand description

§Pretint - Pretty Print Library for Rust

A comprehensive logging library inspired by Pino but designed for Rust with multiple APIs and easier usage. Features structured logging, multiple output formats, and performance timing.

§Quick Start

use pretint::{Pretint, Level};
 
let logger = Pretint::new();
logger.info("Hello, world!");
logger.info_with_fields("User logged in", &[("user_id", "123"), ("ip", "192.168.1.1")]);

§Features

  • Multiple output formats (JSON, Pretty, Compact)
  • Structured logging with fields
  • Child loggers for context propagation
  • Performance timing utilities
  • Convenient macros for easy usage
  • Colored output support
  • Multiple log levels (trace, debug, info, warn, error)

Re-exports§

pub use logger::Pretint;
pub use logger::Config;
pub use level::Level;
pub use format::OutputFormat;
pub use errors::PretintError;

Modules§

errors
format
level
logger
macros
prelude
Re-export commonly used items for convenience
timing

Macros§

child_logger
Create a child logger with fields
debug
Log a debug message
debug_fields
Log a debug message with fields
error
Log an error message
error_fields
Log an error message with fields
info
Log an info message
info_fields
Log an info message with fields
logger_with_config
Create a logger with configuration
logger_with_format
Create a logger with a specific format
logger_with_level
Create a logger with a specific level
timer
Create a timer guard for automatic timing
timer_labeled
Create a timer guard with a label
trace
Convenient macros for Pretint logging
trace_fields
Log a trace message with fields
warn
Log a warning message
warn_fields
Log a warning message with fields