defmt-stdout

Crates.iodefmt-stdout
lib.rsdefmt-stdout
version0.1.2
created_at2025-12-23 15:09:38.812374+00
updated_at2026-01-09 20:40:00.61459+00
descriptionTransmit defmt log messages to the standard output (Linux only)
homepage
repositoryhttps://github.com/SakiiCode/defmt-stdout
max_upload_size
id2001677
size8,179
Sakii (SakiiCode)

documentation

README

defmt-stdout

Forwards defmt frames to the standard output to make it usable on Linux desktops.

Requirements

.cargo/config.toml

[build]
target = "x86_64-unknown-linux-gnu" # or -musl

[target.x86_64-unknown-linux-gnu]
rustflags = [
  "-C", "relocation-model=static",
  "-C", "link-arg=-T/usr/lib/x86_64-linux-gnu/ldscripts/elf_x86_64.x",
  "-C", "link-arg=-Tdefmt.x"
]
linker = "gcc"
runner = "./runner.sh"

[target.x86_64-unknown-linux-musl]
rustflags = [
  "-C", "relocation-model=static",
  "-C", "link-arg=-T/usr/lib/x86_64-linux-gnu/ldscripts/elf_x86_64.x",
  "-C", "link-arg=-Tdefmt.x"
]
runner = "./runner.sh"

[env]
DEFMT_LOG = "trace"

runner.sh

#!/bin/sh
$@ | defmt-print -e $1
chmod +x runner.sh

This way cargo run will be automatically piped into defmt-print

main.rs

use defmt_stdout as _;

References

See the discussion here and here and the defmt-serial project

Commit count: 11

cargo fmt