Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Hess <tim.hess@broadcom.com>
  • Loading branch information
bart-vmware and TimHess authored Nov 20, 2024
1 parent 2a9bd55 commit 9762915
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/v4/logging/serilog-logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ As mentioned earlier, the Serilog Dynamic Logger provider extends Serilog. Conse

Alternatively, configuration can be built from code using the Serilog API:

```c#
```csharp
using Serilog;
using Serilog.Events;

Expand All @@ -70,15 +70,15 @@ builder.Logging.AddDynamicSerilog();
```

If you built the Serilog configuration from code, use the appropriate overload instead:
```c#
```csharp
builder.Logging.AddDynamicSerilog(serilogConfiguration);
```

### Serilog API usage

Because dynamic logging is built on the `Microsoft.Extensions.Logging` abstractions, changing log levels dynamically **won't work** if you're using Serilog's static `Log` class directly.

```c#
```csharp
using Serilog;

// Use ILogger instead.
Expand All @@ -87,7 +87,7 @@ Log.Warning("DO NOT USE!");

Instead, use the injectable `ILogger` interface to log messages, and the `ILoggerFactory` interface to create loggers.

```c#
```csharp
using Steeltoe.Logging.DynamicSerilog;

var builder = WebApplication.CreateBuilder(args);
Expand All @@ -105,7 +105,7 @@ exampleLogger.LogInformation("Hello from Example.");

The Serilog dynamic logger supports the use of logger scopes, as well as Serilog's enrichers and destructuring.

```c#
```csharp
using Serilog.Context;
using Steeltoe.Logging.DynamicSerilog;

Expand Down

0 comments on commit 9762915

Please sign in to comment.