-
Notifications
You must be signed in to change notification settings - Fork 104
1.3.0 Release #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.3.0 Release #59
Conversation
Added functionality to support the destructurer operator in BeginScope.
Fixes #50 - include named scopes
Following code using (Logger.BeginScope("Some name"))
using (Logger.BeginScope(42))
using (Logger.BeginScope("Formatted {WithValue}", 12345))
using (Logger.BeginScope(new Dictionary<string, object> { ["ViaDictionary"] = 100 })) ends up as and not like this as stated in here for Scope item
|
@cilerler thanks for checking it out. I've just installed the latest -pre: "Serilog.Extensions.Logging": "1.3.0-dev-10129",
"Serilog.Sinks.Seq": "3.1.1" With the following in Startup.cs: loggerFactory.AddSerilog(new LoggerConfiguration()
.WriteTo.Seq("http://localhost:5341")
.CreateLogger()); And the following in HomeController.cs: public class HomeController : Controller
{
ILogger<HomeController> Logger;
public HomeController(ILogger<HomeController> logger)
{
Logger = logger;
}
public IActionResult Index()
{
using (Logger.BeginScope("Some name"))
using (Logger.BeginScope(42))
using (Logger.BeginScope("Formatted {WithValue}", 12345))
using (Logger.BeginScope(new Dictionary<string, object> { ["ViaDictionary"] = 100 }))
{
Logger.LogInformation("In");
}
return View();
} Result in Seq: Can you spot any differences with the setup you're using? |
project.json
Startup.cspublic void Configure(ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddSeq(Configuration.GetSection("Seq"));
}
|
Aha :-) that would be this project. If you change the version of the package to Cheers! |
Sorry about that, changed it and confirming that it is working like a charm. Thanks again! 😎 |
@nblumhardt should we take to opportunity to bump to https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions/1.1.0 |
And possibly v2.3.0 of Serilog? |
@merbla keen to push the version of the Serilog dependency forwards; I think it might be a bit early to cut off support for the 1.0 version of MEL, though - may be some apps that can't move forward yet. Perhaps we bump both versions up in |
@
operator in formatted scope messagesScope
property and capture more scope types including"names"