Closed kevingates closed 4 years ago
public static class NameDoesNotMatter
{
public static LoggerConfiguration WithMethodParameters(this LoggerEnrichmentConfiguration enrichmentConfiguration)
{
if (enrichmentConfiguration == null)
throw new ArgumentNullException(nameof(enrichmentConfiguration));
return enrichmentConfiguration.With<AddComponentMethodParametersSerilogEnricher>();
}
}
+
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId", "WithMethodParameters" ]
But I think that MethodBase.GetCurrentMethod().DeclaringType
will always return AddComponentMethodParametersSerilogEnricher
Assuming @sungam3r 's solution sorted this out :+1:
Problem
The Default Routing gives RequestPath, but with Blazor that's
/_Blazor
.I would like to be able to have the File/Component Name, the Method Being Called, and Any Method Parameters for proper debugging.
Type of Data Desired
On a standard Log.Information, I could do this:
Desired Solution
Which does return for me the helpful information. But Honestly, I think this would be helpful for all of my log entries so I know in what files the events occurred, which would be helpful for debugging. So if I do
Log.Error
orLog.Information
, I will always have those 3 things supplied.Current Attempt
I've tried to follow the guide to create a new file:
At this point, I'm at a loss of getting this connected to the enricher. I'm using appsettings for my Serilog configuration.
Program.cs
appsettings.json
, the relevant parts: