Skip to content
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

Make :lj formatting the default/only option for message templates #2011

Open
nblumhardt opened this issue Feb 8, 2024 · 0 comments
Open

Comments

@nblumhardt
Copy link
Member

Message templates processed directly via the MessageTemplate class, and therefore by default in various sinks, use quotes around embedded string values:

Log.Information("Hello, {Name}!", "world");
// -> Hello, "world"!

This is surprising and usually not desired. Modern formatting options such as Serilog.Sinks.Console's custom output formatter, and ExpressionTemplate, do away with this:

Log.Information("Hello, {Name}!", "world");
// -> Hello, world!

Similarly, older formatters use a C#-like syntax for rendering objects - {Name = "world"}, while newer ones just produce JSON - {"Name": "world"}.

It's time to do away with the old convention and make the codebase behave consistently throughout, using the new formatting style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant