Skip to content

Instantly share code, notes, and snippets.

@skalahonza
Created November 16, 2020 10:12
Show Gist options
  • Save skalahonza/e7d218dc6e6435d764f79f96e3f4b4c8 to your computer and use it in GitHub Desktop.
Save skalahonza/e7d218dc6e6435d764f79f96e3f4b4c8 to your computer and use it in GitHub Desktop.
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