rust-lang / rust-lang/log

Proposal: Extend log crate with contextual, typed, and fatal-level logging

Open
#700 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.5k
Forks
289
Avg merge
55m
Merged PRs (30d)
1

Description

Motivation: Automotive Use Case

  1. Contextual / Hierarchical Logging
  • Current target (module path) is too flat for complex automotive applications where multiple layers/modules may reuse common subsystems.
  • Developers need to distinguish who logged what not only by module but also by parent/ancestor context.
  • Add optional hierarchical context (e.g. ECU → Subsystem → Component).
  • Such context could be attached automatically (per logger instance) and optionally extended by the user.
  • Enables better traceability of log origins in safety-critical systems.
  1. Type-Aware Logging
  • Today everything is stringified, discarding type info needed by automotive backends (e.g. DLT expects type fidelity: numeric vs string vs struct).
  • Proposal: allow passing typed values directly (info!(42), info!("user_id" = 43), info!(User { id: 7 })).
  • Preserves fidelity for DLT and similar tools, enables filtering/sorting, while staying backward-compatible and simple for developers.
  1. Fatal Log Level
  • Current Error conflates recoverable and unrecoverable failures.
  • Add a Fatal level for logging critical, fail-stop conditions.
  • Essential for automotive where safety hazards must be identified and escalated distinctly.

Benefits

  • Improves interoperability with standards (e.g. DLT, AUTOSAR logging).
  • Strengthens suitability for safety-critical domains (ISO 26262 compliance).
  • Still lightweight: could be added as opt-in features, maintaining compatibility.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the current logging levels, module-path targets, and info! usage described in the proposal. Define the scope and compatibility requirements for hierarchical context, typed values, and a fatal level; done requires an agreed design covering all three areas before implementation begins.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.