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

Respect explicit format specifiers even when JSON defaults are selected #1325

Merged
merged 1 commit into from Jun 22, 2019

Conversation

nblumhardt
Copy link
Member

@nblumhardt
Copy link
Member Author

Okay, so, the mechanism that Console uses here is different; at the top level, it falls back to non-JSON "display" formatting:

https://github.com/serilog/serilog-sinks-console/blob/dev/src/Serilog.Sinks.Console/Sinks/SystemConsole/Formatting/ThemedJsonValueFormatter.cs#L47

Which in turn ends up calling ScalarValue.Render():

https://github.com/serilog/serilog-sinks-console/blob/dev/src/Serilog.Sinks.Console/Sinks/SystemConsole/Formatting/ThemedDisplayValueFormatter.cs#L184

We could try lining these up, but I think rather than try to keep them 100% in sync, it's okay as long as each behaves predictably, at least for now.

A better future design might be to adopt the ConsoleTheme.None formatting into the core Serilog package, somehow, and share the code.

For now, I think this is ready to go.

@nblumhardt nblumhardt marked this pull request as ready for review June 21, 2019 08:36
Copy link
Member

@tsimbalar tsimbalar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ! 👀

@nblumhardt nblumhardt merged commit e6936a1 into serilog:dev Jun 22, 2019
@nblumhardt
Copy link
Member Author

Thanks @tsimbalar ! 👍

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

Successfully merging this pull request may close these issues.

Numeric format specifier not respected
2 participants