logo
Expand description

Formatters for logging tracing events.

This module provides several formatter implementations, as well as utilities for implementing custom formatters.

Formatters

This module provides a number of formatter implementations:

  • Full: The default formatter. This emits human-readable, single-line logs for each event that occurs, with the current span context displayed before the formatted representation of the event. See here for sample output.

  • Compact: A variant of the default formatter, optimized for short line lengths. Fields from the current span context are appended to the fields of the formatted event, and span names are not shown; the verbosity level is abbreviated to a single character. See here for sample output.

  • Pretty: Emits excessively pretty, multi-line logs, optimized for human readability. This is primarily intended to be used in local development and debugging, or for command-line applications, where automated analysis and compact storage of logs is less of a priority than readability and visual appeal. See here for sample output.

  • [Json]: Outputs newline-delimited JSON logs. This is intended for production use with systems where structured logs are consumed as JSON by analysis and viewing tools. The JSON output is not optimized for human readability. See here for sample output.

Structs

Marker for Format that indicates that the compact log format should be used.

The default FormatFields implementation.

The visitor produced by DefaultFields’s MakeVisitor implementation.

A FormatFields implementation that formats fields by calling a function or closure.

The visitor produced by FieldFn’s MakeVisitor implementation.

Configures what points in the span lifecycle are logged as events.

A pre-configured event formatter.

Marker for Format that indicates that the default log format should be used.

An excessively pretty, human-readable event formatter.

An excessively pretty, human-readable MakeVisitor implementation.

The visitor produced by Pretty’s MakeVisitor implementation.

A writer to which formatted representations of spans and events are written.

Traits

A type that can format a tracing Event to a Writer.

A type that can format a set of fields to a Writer.

Functions

Returns a FormatFields implementation that formats fields using the provided function or closure.

Returns the default configuration for an [event formatter].