class

Tracing::FmtLayer

Inherits Tracing::Layer < Reference < Object

A Layer that formats spans and events to an IO writer.

Ported from upstream tracing_subscriber::fmt.

Constructors

make_writer
Source
new(io : IO = STDOUT, filter : LevelFilterLayer | Nil = nil)
Source
with_test_writer
Source

Instance methods

compact
Source
enabled?(metadata : Metadata, ctx : LayerContext) : Bool

Returns true if this layer would enable the given metadata.

Source
event_format(fmt : FmtFormat::FormatEvent) : self
Source
flatten_event(flatten : Bool) : self
Source
json
Source
max_level_hint

Returns the max level hint for this layer.

Source
on_enter(id : Core::Span::Id, ctx : LayerContext) : Nil

Called when a span is entered.

Source
on_event(event : Core::Event, ctx : LayerContext) : Nil

Called when an event is recorded.

Source
on_exit(id : Core::Span::Id, ctx : LayerContext) : Nil

Called when a span is exited.

Source
on_new_span(attrs : Core::Span::Attributes, id : Core::Span::Id, ctx : LayerContext) : Nil

Called when a new span is created.

Source
on_record(id : Core::Span::Id, values : Core::Span::Record, ctx : LayerContext) : Nil

Called when fields are recorded on a span.

Source
pretty
Source
with_ansi(use : Bool) : self
Source
with_current_span(show : Bool) : self
Source
with_filter(filter : LevelFilter) : self
Source
with_level(show : Bool) : self
Source
with_make_writer(mw : FmtWriter::MakeWriter) : self
Source
with_none_timer
Source
with_span_events(events : FmtSpan) : self
Source
with_span_list(show : Bool) : self
Source
with_target(show : Bool) : self
Source
with_test_writer
Source
with_thread_ids(show : Bool) : self

Display the current thread's identifier. In Crystal, threads map to fibers, so this shows the fiber's object id (see Divergences).

Source
with_thread_names(show : Bool) : self

Display the current thread's name. In Crystal, threads map to fibers, so this shows the fiber's name (see Divergences).

Source
with_timer(timer : FmtTime::FormatTime | Nil) : self
Source
without_time
Source
writer_block=(writer : -> IO | Nil) : Nil
Source