Skip to content

Commit 0696cb2

Browse files
mus65Rob-Hague
andauthored
Update docfx/logging.md
Co-authored-by: Rob Hague <[email protected]>
1 parent ee25d61 commit 0696cb2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docfx/logging.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
Logging
22
=================
33

4-
SSH.NET uses the `Microsoft.Extensions.Logging` API to log diagnostic messages. In order to access the log messages of SSH.NET in your own application for diagnosis, simply register your own `ILoggerFactory` before using the SSH.NET APIs with the following code:
4+
SSH.NET uses the `Microsoft.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:
55

66
```cs
7-
SshNetLoggingConfiguration.InitializeLogging(loggerFactory);
8-
```
7+
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
8+
{
9+
builder.SetMinimumLevel(LogLevel.Debug);
10+
builder.AddConsole();
11+
});
12+
13+
Renci.SshNet.SshNetLoggingConfiguration.InitializeLogging(loggerFactory);
914

1015
All messages by SSH.NET are logged under the `Renci.SshNet` category.

0 commit comments

Comments
 (0)