@@ -151,6 +151,34 @@ error!(%err, "Active stage failed");
151151** Rationale** : consistency.
152152We can rely on this to filter and collect diagnostics.
153153
154+ ### Log levels
155+
156+ Choose a level by how often the event fires and who needs it, keeping in mind that
157+ IronRDP crates are libraries embedded into a final client which owns the default
158+ verbosity. The final consumer should not be flooded at default level by routine
159+ protocol mechanics.
160+
161+ - ` info! ` : reserved for ** rare lifecycle milestones** a consumer would typically want
162+ at default verbosity (e.g. connection or session lifecycle transitions). It should
163+ be uncommon in a library, and never used for anything that repeats during normal
164+ operation (per copy/paste, per lock/unlock, per frame, etc.).
165+ - ` debug! ` : ** significant one-off events** — nothing that repeats in abundance, and no
166+ "entering function X" tracing.
167+ - ` trace! ` : everything else, the fine-grained detail you only want when that is all
168+ that is left to understand a problem.
169+
170+ ``` rust
171+ // GOOD: a rare lifecycle milestone the consumer wants by default.
172+ info! (% server_addr , " Connection established" );
173+
174+ // BAD: fires on every clipboard lock/unlock — routine mechanics belong at debug!/trace!.
175+ info! (count = cleared . len (), " Releasing outgoing locks before taking clipboard ownership" );
176+ ```
177+
178+ ** Rationale** : the binary at the top of the stack decides what to surface to the user;
179+ a library that emits ` info! ` for routine operations takes that choice away and spams
180+ default logs.
181+
154182[ tracing-fields ] : https://docs.rs/tracing/latest/tracing/index.html#recording-fields
155183
156184## Helper functions
0 commit comments