From 9e89933b76624af0d5940764572235ca68572fcb Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Wed, 27 Dec 2023 13:56:47 +0100 Subject: [PATCH] Debug and Handlers documentation updates --- Documentation/docs/events/Examples.md | 14 ++++++++++++-- Documentation/docs/how-to/debug.md | 9 +++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 Documentation/docs/how-to/debug.md diff --git a/Documentation/docs/events/Examples.md b/Documentation/docs/events/Examples.md index 5d9c2801..cc0eae26 100644 --- a/Documentation/docs/events/Examples.md +++ b/Documentation/docs/events/Examples.md @@ -7,13 +7,19 @@ The following serves as a few examples on how to utilize the built in event syst ## Pattern -All events are available on the client instance: `client.`. Handlers can be assigned to the event by simply adding your handler to the list: +All events are available on the client instance: `client.`. + +Handlers can be assigned to the event by simply adding your handler to the list. Handlers can be either a pre-defined function or a lambda (illustrated in the next section). ```csharp client.AfterDisconnect += MyAfterDisconnectHAndler ``` -...where `MyAfterDisconnectHandler` is an already-defined function in my application. +...where `MyAfterDisconnectHandler` is an already-defined function in my application with the following signature: + +```csharp +static void MyAfterDisconnectHandler(object? sender, AfterDisconnectEventArgs eventArgs) +``` ### Lambdas @@ -26,6 +32,10 @@ client.AfterUnsubscribe += (sender, args) => } ``` +### Event Arguments + +The definitions for all event arguments [can be found here](https://github.com/hivemq/hivemq-mqtt-client-dotnet/tree/main/Source/HiveMQtt/Client/Events). + ## Display Options Prior to Connecting This example simply prints out the `HiveMQClientOptions` prior to the connect command being sent to the broker. diff --git a/Documentation/docs/how-to/debug.md b/Documentation/docs/how-to/debug.md new file mode 100644 index 00000000..23af1c7e --- /dev/null +++ b/Documentation/docs/how-to/debug.md @@ -0,0 +1,9 @@ +# How to Debug + +When working with the HiveMQtt client, there may be instances where deeper insight into the internal workings of the client is necessary to troubleshoot or understand its behavior. One of the most effective ways to gain this insight is through TRACE level logging. + +# Understanding TRACE Level Logging + +TRACE level logging is the most detailed form of logging, providing comprehensive information about the events happening within the HiveMQtt client. Enabling TRACE logging allows you to see a fine-grained view of the client's operations, which can be invaluable for debugging complex issues. + +See [How to Configure Logging](/docs/how-to/configure-logging) for the specifics on how to enable TRACE logging.