Skip to main content

Logging

iroh uses the tracing crate for logging. To see what’s happening inside iroh, you need to enable logging in your application.

Setup

First, add the tracing subscriber dependency:
Then, at the top of your main function, initialize the subscriber:

Running with logs

Now run your application with the RUST_LOG environment variable to control the log level:
This will print log messages to your terminal, helping you understand what iroh is doing and diagnose any issues.

Doctor CLI

iroh doctor is a command-line tool that helps you diagnose network connectivity issues with your iroh setup.

Installation

Home Relay

All iroh endpoints will maintain a single home relay server that they’re reachable at. On startup iroh will probe its configured relays & choose the one with the lowest latency. Report on the current network environment, using either an explicitly provided stun host or the settings from the config file by using iroh-doctor report.
An example output looks like this:
The above output shows that the endpoint is using the use1-1.relay.iroh.network relay, and that it has a latency of 10ms. This is the relay that the endpoint will use to establish connections with other endpoints.

Network Diagnostics

To diagnose connectivity issues on your users’ endpoints in production, use Network Diagnostics. It runs the same kinds of probes as iroh-doctor (UDP connectivity, NAT type, relay latency, port mapping) but you trigger them from the Iroh Services dashboard against any of your project’s online endpoints. The report comes back to the dashboard, so you can see what your user is experiencing without asking them to run a CLI tool. To enable diagnostics on an endpoint, grant the NetDiagnosticsCap::GetAny capability and run a ClientHost. See the Network Diagnostics integration guide for the full setup.