You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. For example, "I'd like to do x but currently I can't because y [...]".
I'd like to keep the existing template almost entirely as-is, including across future Serilog updates. But, I'd like to modify one aspect of it, which I'm willing to take on myself.
However, in FileConfigurationExtensions.cs, DefaultOutputTemplate is a private constant rather than a public one, so I'm unable to programmatically modify it to suit my needs. I must instead copy/paste it.
I'd like DefaultOutputTemplate to be a public constant. This way I can reference it in constructing my own template.
Describe alternatives you've considered
Copying/pasting DefaultOutputTemplate into my code and adding a comment indicating where I got it from.
Additional context
I want to output the HttpRequestId that comes from .Enrich.WithHttpRequestId() as part of this particular log file, to make tracing through files easier. So I'm looking to do something along the lines of:
vartemplate=FileLoggerConfigurationExtensions.DefaultOutputTemplate.Replace("[{Level:u3}] ","[{Level:u3}] [Request {HttpRequestId}] ");// Use template in Serilog
I'll submit a PR on this just in case you're interested, as the work itself is small. I couldn't find any historical precedent on whether it is considered acceptable to make the template public.
The text was updated successfully, but these errors were encountered:
To be clear, I'm not sure this is something that a lot of folks want to do in a typical situation vs having their own const and not taking the performance hit. So it's totally acceptable for me if the aim is to hide this so that people reach that conclusion by default. If that's the case, feel free to disregard and close. 👍
I've wondered about this too, in the past - definitely times when it would be handy. Discoverability is not ideal, and there are some questions around evolution and breaking changes that I think leave this on just short of enough benefit to get across the line.
I'll leave this open for the time being so that anyone interested can chime in. Cheers!
@nblumhardt yeah, I hear you for sure. Discoverability is not ideal, and yet I discovered it quickly enough. Turned it into my own const with a link to where I found it. Seems like the way to go, honestly. I'm leaning toward closing this one myself; no worries if someone else does.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. For example, "I'd like to do x but currently I can't because y [...]".
I'd like to keep the existing template almost entirely as-is, including across future Serilog updates. But, I'd like to modify one aspect of it, which I'm willing to take on myself.
However, in
FileConfigurationExtensions.cs
,DefaultOutputTemplate
is a private constant rather than a public one, so I'm unable to programmatically modify it to suit my needs. I must instead copy/paste it.https://github.com/serilog/serilog-sinks-file/blob/dev/src/Serilog.Sinks.File/FileLoggerConfigurationExtensions.cs#L35
Describe the solution you'd like
I'd like
DefaultOutputTemplate
to be a public constant. This way I can reference it in constructing my own template.Describe alternatives you've considered
Copying/pasting
DefaultOutputTemplate
into my code and adding a comment indicating where I got it from.Additional context
I want to output the HttpRequestId that comes from
.Enrich.WithHttpRequestId()
as part of this particular log file, to make tracing through files easier. So I'm looking to do something along the lines of:I'll submit a PR on this just in case you're interested, as the work itself is small. I couldn't find any historical precedent on whether it is considered acceptable to make the template public.
The text was updated successfully, but these errors were encountered: