import Image from "@components/Image.astro"; import LoggingConsoleImg from "@img/dotnet-logging-console.png";
Logging
Logging is an important part of any application to understand what is happening. The .NET SDK supports the built-in logging API offered by the Microsoft.Extensions.Logging NuGet package.
Logging categories
The SurrealDB SDK for .NET has a set of logging categories so that you can pick what you want to display, using the respective LogLevel.
Example:
This example will enable the following logging features:
Connection- Logger category for messages related to connection operations.Method- Logger category for method execution, excludingConnectmethod.Query- Logger category for messages related to written or generated queries, that can be executed withinQueryorRawQuery.Serialization- Logger category for data serialization and deserialization, e.g. hexa CBOR format exchanged between the client and a SurrealDB instance.
Important
Note
Sensitive data
To prevent data leakage, the property SensitiveDataLoggingEnabled of SurrealDbLoggingOptions is set to true by default.
When the feature is enabled, any data that is passed to a SurrealDB method is replaced by the placeholder value ?. Example:
If needed, you can override this option using the EnableSensitiveDataLogging when building a new SurrealDbOptions instance.