log

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

Library
Cargo
v0.4.34
2,552 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 →
71 /100 Good
Development Activity 60
Maintenance 48
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

Dart
74%
AGPL 3.0

AppFlowy

AI Assistants · Collaboration · Productivity

76,967

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
67
Dependency
Built with
Dart 74%
Rust 24%
Updated 1 weeks ago
Rust
86%
Other

Arroyo

Analytics · Data Engineering

5,039

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust 86%
Updated 1 weeks ago
Rust
54%
Other

Cap

Team Chat · Video Conferencing

22,884

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
64
Dependency
Built with
Rust 54%
TypeScript 42%
Updated 4 days ago
Rust
95%
MIT

claw-code

AI Agents · AI Code Assistants

195,291

A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.

View details
51
Repo Health
71
Technical
77
Dependency
Built with
Rust 95%
Updated 1 months ago
C++
68%
Apache 2.0

ClickHouse

Analytics · Data Engineering · Databases

50,116

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
64
Dependency
Built with
C++ 68%
Python 14%
Updated 4 days ago
Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
TypeScript
64%
Other

Epicenter

Developer Tools · Knowledge Management · Note Taking

4,808

A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.

View details
88
Repo Health
90
Technical
64
Dependency
Built with
TypeScript 64%
HTML 13%
Svelte 13%
Updated 5 days ago
Python
65%
MIT

Flowfile

Data Engineering

363

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

View details
83
Repo Health
81
Technical
66
Dependency
Built with
Python 65%
Vue 17%
TypeScript 17%
Updated 5 days ago
Rust
59%
MIT

Handy

Productivity · Voice AI

32,320

Free, offline, open-source speech-to-text that pastes directly into any app on Windows, macOS, and Linux.

View details
87
Repo Health
78
Technical
72
Dependency
Built with
Rust 59%
TypeScript 30%
Updated 4 days 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