Skip to main content

Crate typub_log

Crate typub_log 

Source
Expand description

Logging foundation for typub based on tracing.

This crate provides:

  • Re-exported tracing macros (debug!, info!, warn!, error!)
  • A custom CliLayer for CLI-formatted output with icons and colors
  • The ProgressReporter trait for decoupling progress reporting from UI

Per [[ADR-0004]], this crate is Layer 0 (no internal typub dependencies).

§Usage

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

// Structured logging with tracing
info!(file = %path.display(), "Processing file");
debug!(count = 42, "Items processed");
warn!(platform = "ghost", "Rate limit approaching");
error!(error = %e, "Upload failed");

§Initialization

Call init() at CLI startup to install the CLI subscriber:

typub_log::init(verbose);

Modules§

span
Spans represent periods of time in which a program was executing in a particular context.

Macros§

debug
Constructs an event at the debug level.
error
Constructs an event at the error level.
info
Constructs an event at the info level.
span
Constructs a new span.
trace
Constructs an event at the trace level.
warn
Constructs an event at the warn level.

Structs§

CliLayer
A tracing layer that formats events for CLI output.
FnReporter
A progress reporter that wraps a closure.
Level
Describes the level of verbosity of a span or event.
NullReporter
A progress reporter that discards all reports.
Span
A handle representing a span, with the capability to enter the span if it exists.

Traits§

ProgressReporter
Trait for reporting progress during long-running operations.

Functions§

init
Initialize the CLI logging subscriber.
is_verbose
Check if verbose mode is enabled