Crate defmt[][src]

Expand description

A highly efficient logging framework that targets resource-constrained devices, like microcontrollers.

Check out the defmt book at https://defmt.ferrous-systems.com for more information about how to use it.

Compatibility

The defmt wire format might change between major versions. Attempting to read a defmt stream with an incompatible version will result in an error. This means that you have to update both the host and target side if a breaking change in defmt is released.

Macros

assert

Just like the core::assert! macro but defmt is used to log the panic message

assert_eq

Just like the core::assert_eq! macro but defmt is used to log the panic message

assert_ne

Just like the core::assert_ne! macro but defmt is used to log the panic message

dbg

Just like the std::dbg! macro but defmt is used to log the message at TRACE level.

debug

Logs data at debug level.

debug_assert

Just like the core::debug_assert! macro but defmt is used to log the panic message

debug_assert_eq

Just like the core::debug_assert_eq! macro but defmt is used to log the panic message

debug_assert_ne

Just like the core::debug_assert_ne! macro but defmt is used to log the panic message

error

Logs data at error level.

info

Logs data at info level.

intern

Creates an interned string (Str) from a string literal.

panic

Just like the core::panic! macro but defmt is used to log the panic message

timestamp

Defines the global timestamp provider for defmt.

todo

Just like the core::todo! macro but defmt is used to log the panic message

trace

Logs data at trace level.

unimplemented

Just like the core::unimplemented! macro but defmt is used to log the panic message

unreachable

Just like the core::unreachable! macro but defmt is used to log the panic message

unwrap

Unwraps an Option or Result, panicking if it is None or Err.

warn

Logs data at warn level.

write

Writes formatted data to a Formatter.

Structs

Debug2Format

An “adapter” type to feed Debug values into defmt macros, which expect defmt::Format values.

Display2Format

An “adapter” type to feed Display values into defmt macros, which expect defmt::Format values.

Formatter

Handle to a defmt logger.

Str

An interned string created via intern!.

Traits

Format

Trait for types that can be formatted via defmt.

Logger

Global logger acquire-release mechanism

Write

Trait for defmt logging targets.

Attribute Macros

global_logger

Defines the global defmt logger.

panic_handler

Overrides the panicking behavior of defmt::panic!