diff --git a/README.md b/README.md index fb958e9b..9a4097eb 100644 --- a/README.md +++ b/README.md @@ -38,14 +38,14 @@ cd ~/ws_rmw_zenoh source install/setup.bash ``` -### Start the zenoh router -> Note: Manually launching zenoh router won't be necessary in the future. +### Start the Zenoh router +> Note: Manually launching Zenoh router won't be necessary in the future. ```bash # terminal 1 ros2 run rmw_zenoh_cpp rmw_zenohd ``` -> Note: Without the zenoh router, nodes will not be able to discover each other since multicast discovery is disabled by default in the node's session config. Instead, nodes will receive discovery information about other peers via the zenoh router's gossip functionality. See more information on the session configs [below](#config). +> Note: Without the Zenoh router, nodes will not be able to discover each other since multicast discovery is disabled by default in the node's session config. Instead, nodes will receive discovery information about other peers via the Zenoh router's gossip functionality. See more information on the session configs [below](#config). ### Terminate ROS 2 daemon started with another RMW ```bash @@ -119,3 +119,15 @@ In this example, the `Zenoh router` will connect to the `Zenoh router` running o ``` > Note: To connect multiple hosts, include the endpoints of all `Zenoh routers` in the network. + +### Logging + +The core of Zenoh is implemented in Rust and uses a logging library that can be configured via a `RUST_LOG` environment variable. +This variable can be configured independently for each Node and the Zenoh router. +For instance: +- `RUST_LOG=zenoh=info` activates information logs about Zenoh initialization and the endpoints it's listening on. +- `RUST_LOG=zenoh=info,zenoh_transport=debug` adds some debug logs about the connectivity events in Zenoh. +- `RUST_LOG=zenoh=info,zenoh::net::routing::queries=trace` adds some trace logs for each query (i.e. calls to services and actions). +- `RUST_LOG=zenoh=debug` activates all the debug logs. + +For more information on the `RUST_LOG` syntax, see https://docs.rs/env_logger/latest/env_logger/#enabling-logging. diff --git a/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp b/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp index 78d5b412..1b6a3098 100644 --- a/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp @@ -223,9 +223,10 @@ std::string zid_to_str(const z_id_t & id) { std::stringstream ss; ss << std::hex; - size_t i = 0; - for (; i < (sizeof(id.id)); i++) { - ss << static_cast(id.id[i]); + for (std::size_t i = 0; i < sizeof(id.id); i++) { + // By Zenoh convention a z_id_t is a little endian u128. + const std::size_t le_idx = sizeof(id.id) - 1 - i; + ss << static_cast(id.id[le_idx]); } return ss.str(); }