Created
November 16, 2020 10:12
-
-
Save skalahonza/e7d218dc6e6435d764f79f96e3f4b4c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Logging; | |
using System; | |
using System.Linq; | |
public static class LoggingExtensions | |
{ | |
public static IDisposable BeginPropertyScope(this ILogger logger, params (string key, object value)[] properties) => | |
logger.BeginScope(properties.ToDictionary(p => p.key, p => p.value)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment