lagos_logger 0.2.5

A simple, colorful logging macro crate
Documentation

lagos_logger

A simple, pretty, and lightweight logger for Rust.

Installation

To add this to your Cargo project with the default timestamp support, run:

cargo add lagos_logger

Optional Timestamps (Features)

By default, lagos_logger includes timestamps in its output. If you want to disable timestamps (which removes the chrono dependency for faster compilation and a smaller binary), you can disable default features:

cargo add lagos_logger --no-default-features

Usage

Import the logger! macro and use one of the built-in log types: Info, Warn, Error, Running, or Success. The log type is optional and defaults to Info if omitted. It works just like println! for variables and formatting.

use lagos_logger::{logger, Level};

fn main() {
    let port = 8080;

    // By default, omitting the log level defaults to Info:
    logger!("Loading configuration files...");
    logger!("Connected to database at: {}", "localhost");

    // Or explicitly use other log types!
    logger!(Level::Running, "Starting server on port {}", port);
    logger!(Level::Warn, "Missing optional config, using defaults");
    logger!(Level::Success, "Server is fully operational!");

    // Variables work seamlessly
    let error_code = 500;
    logger!(Level::Error, "Failed to connect: Code {}", error_code);
}

Crate

https://crates.io/crates/lagos_logger