log

A lightweight logging facade for Rust that decouples libraries from the logging implementation applications choose.

Library
Cargo
v0.4.34
2,557 stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
79 /100 Good
Development Activity 76
Maintenance 64
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
90 /100 Excellent
Architecture 92
Code Quality 90
Innovation 88
Learning Curve 90

log is the de facto standard logging facade for the Rust ecosystem. It provides a single, lightweight logging API built around five leveled macros - error!, warn!, info!, debug! and trace! - that libraries call without committing to any particular output backend. Applications then select and initialize a compatible logger implementation (such as env_logger, fern, or log4rs) at startup, so the same instrumented code can log to the console, a file, syslog, or anywhere else.

When no logger is installed, log falls back to a zero-cost noop that reduces each call to an integer load, comparison, and jump, making it safe to instrument hot paths. Optional compile-time level filtering and an opt-in structured key-value (kv) API round out a facade that is depended on by a huge share of the crates.io registry.

What You Get

  • Five leveled logging macros - error!, warn!, info!, debug! and trace! - plus the general log! macro, all accepting println!-style format strings.
  • The Log trait and a global logger registration API (set_logger / set_boxed_logger) that any backend can implement.
  • A zero-cost noop fallback when no logger is initialized, so instrumentation is safe to leave in hot paths.
  • Compile-time and runtime level filtering, including release-specific max-level features to strip verbose logging from production builds.
  • An optional structured logging (kv) API for attaching typed key-value data to records via Serde or sval.

Common Use Cases

  • Instrumenting a reusable library so downstream consumers can capture its diagnostics without dictating their logging stack.
  • Wiring an application to a concrete backend (env_logger, fern, log4rs, tracing-log) initialized once at startup.
  • Stripping debug and trace calls from release binaries at compile time using the release_max_level_* features for zero runtime overhead.
  • Attaching structured key-value context to log records for machine-parseable, searchable output.

Under The Hood

Architecture - The crate centers on the Log trait (enabled, log, flush) in src/lib.rs, a single global logger stored behind an AtomicUsize state machine plus a &'static dyn Log reference set once via set_logger/set_boxed_logger. The user-facing macros in src/macros.rs expand to a cheap STATIC_MAX_LEVEL comparison against the record’s level before ever touching the global logger, so disabled calls short-circuit to a noop. Record data flows through Record/RecordBuilder and Metadata structs, with __private_api.rs bridging macro expansions to the runtime; the optional kv module under src/kv/ layers a Source/Key/Value model over records for structured data. Tech Stack - Pure Rust (edition 2021, MSRV 1.71), zero required runtime dependencies; optional integrations are gated behind Cargo features - serde_core, sval/sval_ref, and value-bag power the kv_serde/kv_sval structured-logging paths. A rich feature matrix (std, kv, and the max_level_* / release_max_level_* families) controls compile-time behavior. Code Quality - Mature and heavily tested: dedicated integration and macro test suites live in tests/integration.rs and tests/macros.rs, a separate test_max_level_features/ workspace exercises the static-level feature combinations, and benches/ guards performance. Naming is consistent, the public surface is small and well-documented with doc examples that double as doctests, and 138 contributors over a decade reflect strong review discipline. API Design - Exceptionally ergonomic: instrumenting code is a one-line use log::info; plus a println!-style call, and the facade/implementation split means library authors need make no backend decisions. The macros accept optional target: and logger: arguments and inline capture syntax, the structured kv extensions are opt-in so newcomers are never exposed to complexity they don’t need, and near-zero boilerplate is required to get started.

Used by 38 apps in this directory

TypeScript
47%
Other

Stirling PDF

Digital Signiture · Productivity

94,824

The open-source PDF platform you can run anywhere — edit, convert, sign, and automate PDFs without sending files to external servers.

View details
92
Repo Health
86
Technical
68
Dependency
Built with
TypeScript 47%
Java 44%
Updated 5 days ago
TypeScript
67%
Apache 2.0

tabularis

Databases · Developer Tools

5,270

Open-source desktop SQL workspace with built-in PostgreSQL, MySQL, and SQLite drivers, SQL notebooks, a visual query builder, and a built-in MCP server for AI agents like Claude and Cursor.

View details
84
Repo Health
89
Technical
66
Dependency
Built with
TypeScript 67%
Rust 31%
Updated 5 days ago
C
74%
AGPL 3.0

TDengine

Databases

25,168

A high-performance, open-source time-series database built in C for IoT, connected vehicles, and industrial monitoring workloads, with built-in stream processing, caching, and data subscription.

View details
97
Repo Health
71
Technical
65
Dependency
Built with
C 74%
C++ 19%
Updated 1 weeks ago
Rust
66%
Apache 2.0

Temps

Analytics · Devops · Monitoring

865

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
66
Dependency
Built with
Rust 66%
TypeScript 33%
Updated 6 days ago
Rust
79%
Apache 2.0

TensorZero

Ab Testing Experimentation · AI Development · Monitoring

11,708

TensorZero unifies the LLM gateway, observability, evaluation, optimization, and experimentation stack behind a single OpenAI-compatible API, built in Rust for sub-millisecond p99 latency.

View details
53
Repo Health
87
Technical
68
Dependency
Built with
Rust 79%
TypeScript 15%
Updated 4 months ago
TypeScript
68%
AGPL 3.0

Tolaria

Note Taking

20,161

A free, open-source, local-first desktop app for managing markdown knowledge bases on macOS, Windows, and Linux — for second brains, company docs, or AI assistant memory and procedures.

View details
84
Repo Health
71
Technical
68
Dependency
Built with
TypeScript 68%
HTML 15%
Updated 5 days ago
Rust
71%
MIT

Trieve

AI Development · Developer Tools · Search

2,721

All-in-one self-hostable platform for hybrid search, RAG, recommendations, and analytics built on Rust and Qdrant.

View details
42
Repo Health
74
Technical
65
Dependency
Built with
Rust 71%
Updated 9 months ago
Python
73%
Apache 2.0

Unsloth

AI Assistants · AI Development

78,493

Run and fine-tune LLMs, diffusion, audio and embedding models on your own hardware, from a native desktop app, a browser UI, or a Python library.

View details
89
Repo Health
83
Technical
70
Dependency
Built with
Python 73%
TypeScript 22%
Updated 5 days ago
Rust
83%
AGPL 3.0

Vaultwarden

Password Manager · Security

69,556

Unofficial Bitwarden-compatible server in Rust — run the full Bitwarden ecosystem on a Raspberry Pi using every official client you already have, without the multi-container overhead.

View details
89
Repo Health
69
Technical
69
Dependency
Built with
Rust 83%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers