|
@@ -4,6 +4,8 @@ Logging
|
|
|
SSH.NET uses the [Microsoft.Extensions.Logging](https://learn.microsoft.com/dotnet/core/extensions/logging) API to log diagnostic messages. In order to access the log messages of SSH.NET in your own application for diagnosis, register your own `ILoggerFactory` before using the SSH.NET APIs, for example:
|
|
SSH.NET uses the [Microsoft.Extensions.Logging](https://learn.microsoft.com/dotnet/core/extensions/logging) API to log diagnostic messages. In order to access the log messages of SSH.NET in your own application for diagnosis, register your own `ILoggerFactory` before using the SSH.NET APIs, for example:
|
|
|
|
|
|
|
|
```cs
|
|
```cs
|
|
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
|
|
+
|
|
|
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
|
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
|
|
{
|
|
{
|
|
|
builder.SetMinimumLevel(LogLevel.Debug);
|
|
builder.SetMinimumLevel(LogLevel.Debug);
|
|
@@ -11,5 +13,6 @@ ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
Renci.SshNet.SshNetLoggingConfiguration.InitializeLogging(loggerFactory);
|
|
Renci.SshNet.SshNetLoggingConfiguration.InitializeLogging(loggerFactory);
|
|
|
|
|
+```
|
|
|
|
|
|
|
|
All messages by SSH.NET are logged under the `Renci.SshNet` category.
|
|
All messages by SSH.NET are logged under the `Renci.SshNet` category.
|