molten_smelt

Crates.iomolten_smelt
lib.rsmolten_smelt
version0.1.0
created_at2025-12-14 18:45:47.56132+00
updated_at2025-12-14 18:45:47.56132+00
descriptionBeautiful, structured logging for the terminal ⚒️
homepagehttps://molten.dev
repositoryhttps://github.com/moltenlabs/molten-smelt
max_upload_size
id1984924
size40,431
Chris Mathew (chriscmathew-dorsia)

documentation

https://docs.rs/molten_smelt

README

Smelt

⚒️ Smelt

Beautiful, structured logging for the terminal.

Crates.io Documentation CI License

FeaturesInstallationUsageCustomization


What is Smelt?

Smelt is the Rust equivalent of log from Charmbracelet. It provides gorgeous, human-readable logging with structured key-value pairs.

INFO  Server started port=3000 env=production
WARN  ⚠️  Disk space low available=10GB threshold=20GB
ERROR ❌ Connection failed host=db.example.com retries=3

Features

  • 🎨 Colorful Output - Each log level has its own color
  • 📝 Structured Logging - Add key-value pairs to any log
  • Timestamps - Optional, configurable timestamps
  • 🎯 Log Levels - Debug, Info, Warn, Error, Fatal
  • 🎭 Icons - Optional emoji icons for each level
  • ⚙️ Customizable - Fully configurable styling

Installation

cargo add smelt

Quick Start

Simple Logging

use smelt::{info, warn, error, debug};

info!("Server started");
warn!("Low disk space");
error!("Connection failed");
debug!("Processing request");

With Key-Value Pairs

use smelt::{info, error};

info!("Request received"; "method" => "GET", "path" => "/api/users");
// INFO Request received method=GET path=/api/users

error!("Database error"; "code" => "E001", "table" => "users");
// ERROR Database error code=E001 table=users

Custom Logger

use smelt::{Logger, Level};

let logger = Logger::new()
    .with_timestamp()
    .with_icons()
    .min_level(Level::Info)
    .prefix("myapp");

logger.info("Application started");
// 14:30:45 ℹ️  INFO [myapp] Application started

logger.info_kv("User login", &[
    ("user", &"alice"),
    ("ip", &"192.168.1.1"),
]);
// 14:30:45 ℹ️  INFO [myapp] User login user=alice ip=192.168.1.1

Log Levels

Level Color Icon Use Case
DEBUG Gray 🔍 Verbose debugging information
INFO Blue ℹ️ General information
WARN Amber ⚠️ Warnings that need attention
ERROR Red Errors that need handling
FATAL Dark Red 💀 Critical errors
use smelt::Level;

let logger = Logger::new()
    .min_level(Level::Warn);  // Only show Warn and above

logger.debug("Skipped");  // Not shown
logger.info("Skipped");   // Not shown
logger.warn("Shown");     // Shown
logger.error("Shown");    // Shown

Styling Options

With Timestamps

let logger = Logger::new()
    .with_timestamp();

// 14:30:45 INFO Server started

With Icons

let logger = Logger::new()
    .with_icons();

// ℹ️  INFO Server started
// ⚠️  WARN Low memory

Short Level Names

use smelt::LogStyle;

let style = LogStyle::new()
    .short_level();

let logger = Logger::new()
    .style(style);

// INF Server started (instead of INFO)

Full Style

use smelt::LogStyle;

let style = LogStyle::full();  // timestamps + icons

let logger = Logger::new()
    .style(style);

// 14:30:45 ℹ️  INFO Server started

Minimal Style

use smelt::LogStyle;

let style = LogStyle::minimal();  // just the message

let logger = Logger::new()
    .style(style);

// Server started

Custom Colors

use smelt::LogStyle;
use glyphs::Color;

let style = LogStyle::new()
    .key_color(Color::from_hex("#F97316"))
    .value_color(Color::from_hex("#FAFAFA"));

let logger = Logger::new()
    .style(style);

Global Logger

For convenience, Smelt provides macros that use a global logger:

use smelt::{info, warn, error, debug, fatal};

fn main() {
    info!("Starting up");
    
    if let Err(e) = do_something() {
        error!("Operation failed"; "error" => e.to_string());
    }
}

Ecosystem

Smelt is part of the Molten Labs open source ecosystem:

Crate Description
molten_brand Design tokens & colors
glyphs ANSI escape sequences
lacquer Terminal styling
cauldron TUI framework
sparks TUI components
rune Shell glamour
ember Markdown renderer
smelt Pretty logging (you are here)

Why "Smelt"?

In a forge, to smelt is to extract pure metal from ore. Smelt extracts the essential information from your logs and presents it beautifully. ⚒️


Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.


License

Licensed under either of:

at your option.


Built with ⚒️ by Molten Labs

Commit count: 0

cargo fmt