Skip to content

Commit 1a686a9

Browse files
authored
defmt (#68)
1 parent 13ee557 commit 1a686a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3019
-234
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ jobs:
3636
run: cargo fmt -- --check
3737
- name: Build | Clippy
3838
run: cargo clippy --features std,embedded-svc,edge-nal-embassy --examples --no-deps -- -Dwarnings
39+
- name: Build | Clippy - defmt
40+
run: cargo clippy --features std,embedded-svc,edge-nal-embassy,defmt --no-deps -- -Dwarnings
41+
- name: Build | Clippy - log
42+
run: cargo clippy --features std,embedded-svc,edge-nal-embassy,log --examples --no-deps -- -Dwarnings
3943
- name: Build | Default
40-
run: cargo build
44+
run: cargo build --features log
4145
- name: Build | Non-default
4246
run: cargo build --no-default-features
4347
- name: Build | Embassy
44-
run: cargo build --no-default-features --features embassy
48+
run: cargo build --no-default-features --features embassy,defmt
4549
- name: Build | Examples
46-
run: cargo build --examples
50+
run: cargo build --examples --features log

Cargo.toml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ async-io-mini = ["std", "edge-nal-std/async-io-mini"]
1717
std = ["io", "edge-captive/std", "edge-dhcp/std", "edge-http/std", "edge-mdns/std", "edge-raw/std", "edge-mqtt", "edge-ws/std", "edge-nal-std"]
1818
embassy = ["io", "edge-nal-embassy"]
1919
io = ["edge-captive/io", "edge-dhcp/io", "edge-http/io", "edge-mdns/io", "edge-raw/io", "edge-ws/io", "edge-nal"]
20+
log = ["edge-captive/log", "edge-dhcp/log", "edge-http/log", "edge-mdns/log", "edge-raw/log", "edge-ws/log", "edge-nal-embassy?/log"]
21+
defmt = ["edge-captive/defmt", "edge-dhcp/defmt", "edge-http/defmt", "edge-mdns/defmt", "edge-raw/defmt", "edge-ws/defmt", "edge-nal-embassy?/defmt"]
2022
embedded-svc = ["edge-http/embedded-svc", "edge-mqtt/embedded-svc", "edge-ws/embedded-svc"]
2123
nightly = []
2224

@@ -48,47 +50,47 @@ async-compat = "0.2" # For the `mqtt_client` example
4850

4951
[[example]]
5052
name = "captive_portal"
51-
required-features = ["std"]
53+
required-features = ["std", "log"]
5254

5355
[[example]]
5456
name = "dhcp_client"
55-
required-features = ["std"]
57+
required-features = ["std", "log"]
5658

5759
[[example]]
5860
name = "dhcp_server"
59-
required-features = ["std"]
61+
required-features = ["std", "log"]
6062

6163
[[example]]
6264
name = "http_client"
63-
required-features = ["std"]
65+
required-features = ["std", "log"]
6466

6567
[[example]]
6668
name = "http_server"
67-
required-features = ["std"]
69+
required-features = ["std", "log"]
6870

6971
[[example]]
7072
name = "mdns_responder"
71-
required-features = ["std"]
73+
required-features = ["std", "log"]
7274

7375
[[example]]
7476
name = "mdns_service_responder"
75-
required-features = ["std"]
77+
required-features = ["std", "log"]
7678

7779
[[example]]
7880
name = "ws_client"
79-
required-features = ["std"]
81+
required-features = ["std", "log"]
8082

8183
[[example]]
8284
name = "ws_server"
83-
required-features = ["std"]
85+
required-features = ["std", "log"]
8486

8587
[[example]]
8688
name = "nal_std"
87-
required-features = ["std"]
89+
required-features = ["std", "log"]
8890

8991
[[example]]
9092
name = "mqtt_client"
91-
required-features = ["std", "embedded-svc"]
93+
required-features = ["std", "embedded-svc", "log"]
9294

9395
[workspace]
9496
members = [
@@ -111,7 +113,6 @@ embassy-sync = { version = "0.6", default-features = false }
111113
embassy-time = { version = "0.4", default-features = false }
112114
embedded-io-async = { version = "0.6", default-features = false }
113115
embedded-svc = { version = "0.28", default-features = false }
114-
log = { version = "0.4", default-features = false }
115116
heapless = { version = "0.8", default-features = false }
116117
domain = { version = "0.10", default-features = false, features = ["heapless"] }
117118

edge-captive/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
* Optional `defmt` support via two new features (one has to specify one, or the other, or neither, but not both):
10+
* `log` - uses the `log` crate for all logging
11+
* `defmt` - uses the `defmt` crate for all logging, and implements `defmt::Format` for all library types that otherwise implement `Debug` and/or `Display`
912

1013
## [0.5.0] - 2025-01-15
1114
* Updated dependencies for compatibility with `embassy-time-driver` v0.2

edge-captive/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ std = ["io"]
2020
io = ["edge-nal"]
2121

2222
[dependencies]
23-
log = { workspace = true }
23+
log = { version = "0.4", default-features = false, optional = true }
24+
defmt = { version = "0.3", optional = true }
2425
domain = { workspace = true }
2526
edge-nal = { workspace = true, optional = true }

0 commit comments

Comments
 (0)