Skip to content

feat(logs): device-local log protocol on 1.0.0-rc.1#89

Open
okdistribute wants to merge 4 commits into
b5/relay-constructorfrom
rae/logs-on-rc1
Open

feat(logs): device-local log protocol on 1.0.0-rc.1#89
okdistribute wants to merge 4 commits into
b5/relay-constructorfrom
rae/logs-on-rc1

Conversation

@okdistribute

Copy link
Copy Markdown
Contributor

Forward-ports the device-local file logger and cloud log-level control from #85 (which was based on the pre-1.0 line) onto the current 1.0.0-rc.1 line. Branched off b5/relay-constructor so it carries both the relay-auth preset work and the logs protocol — this is what n0-computer/svc PR #828 needs to build against main (svc moved to iroh-services 1.0.0-rc.1, but the logs protocol only existed on the old #85 branch).

What's included

  • protocol: SetLogLevel + FetchLogs on ClientHostProtocol; GetLogLevel on IrohServicesProtocol
  • caps: LogsCap (Push / SetLevel / Fetch)
  • logs (new module): tracing-subscriber rolling-file layer with a cloud-controlled EnvFilter reload handle (LogCollector); filter starts at off
  • client_host: serves SetLogLevel and streams the current rolling log file for FetchLogs
  • client: optional with_log_collector, pulls GetLogLevel right after auth
  • examples/logs.rs

Porting notes

All of #85's ported APIs compiled unchanged against 1.0.0-rc.1 — no API migration was needed beyond rebasing the diff. clippy, fmt, and the logs / fetch_logs tests pass.

Base / merge order

Targets b5/relay-constructor to keep the diff to just the logs work. Once relay-constructor lands on main, this can be retargeted/rebased onto main, and supersedes #85 on the 1.0 line.

🤖 Generated with Claude Code

Ports the device-local file logger and cloud log-level control from
iroh-services PR #85 (which was based on the pre-1.0 line) onto the
relay-constructor branch / iroh 1.0.0-rc.1:

- protocol: add SetLogLevel + FetchLogs to ClientHostProtocol and
  GetLogLevel to IrohServicesProtocol
- caps: add LogsCap (Push / SetLevel / Fetch)
- logs: new tracing-subscriber file layer with a cloud-controlled
  EnvFilter reload handle (LogCollector)
- client_host: serve SetLogLevel and stream the current rolling log file
  for FetchLogs
- client: optional log collector with initial GetLogLevel pull after auth
- examples/logs.rs

All ported APIs compiled unchanged against 1.0.0-rc.1; clippy, fmt, and
the logs/fetch_logs tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-services/pr/89/docs/iroh_services/

Last updated: 2026-06-09T23:48:50Z

okdistribute and others added 3 commits June 9, 2026 16:33
cargo make format-check uses unstable rustfmt options
(imports_granularity=Crate, group_imports=StdExternalCrate). Reorder the
re-export statements in logs.rs to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tracing-appender (rolling file appender) pulls in `symlink`, which doesn't
build on wasm32, and the FetchLogs path uses tokio::fs — both native-only.
Gate the file-based log collection feature behind
cfg(not(target_arch = "wasm32")):

- tracing-appender moves to the non-wasm target dependency table
- the `logs` module is native-only
- ClientBuilder/ClientActor and ClientHost drop their log_collector on wasm
- the SetLogLevel / FetchLogs ClientHost handlers respond "not available"
  on wasm (the protocol variants stay available everywhere)

Native build/clippy/tests and the wasm32 --no-default-features build all
pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The README was a one-line stub. Expand it for newcomers: what the crate
is (the client side of the iroh-services cloud hub), the two-way
endpoint<->cloud protocol model and capability-gating, a quickstart, and
short sections on each feature — metrics, network diagnostics, the new
device-local logs, and custom relays — plus an examples table.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant