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

Console's default output formatter renders Properties:j including type #89

Open
6 of 7 tasks
zihotki opened this issue Apr 22, 2020 · 0 comments
Open
6 of 7 tasks

Comments

@zihotki
Copy link

zihotki commented Apr 22, 2020

Does this issue relate to a new feature or an existing bug?

  • Bug
  • New Feature

What version of Serilog Console Sink is affected by this issue? Please list the related NuGet package.
All, I assume

What is the target framework and operating system affected by this issue? Please see target frameworks & net standard matrix.

  • netCore 2.0
  • netCore 1.0
  • 4.7
  • 4.6.x
  • 4.5.x

Please describe the current behaviour you are experiencing?
When output template has {Properties:j} it renders complex types as {..., "$type": "..."}.

Please describe the expected behaviour if the ?
Instead it should render it without $type or allow to override that behavior (also in config).

If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
NOTE: A small code sample goes a long way in expediting bug fixes or illustrating an enhancement you are proposing.

        public class HttpRequestInfo
        {
            public PathString Path { get; set; }
            public Dictionary<string, string> QueryString { get; set; }
        }

            Log.Logger = new LoggerConfiguration()
                            .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] <s:{SourceContext}> {Message:lj}{NewLine}{Exception}{NewLine}{Properties:j}{NewLine}")
                            .CreateLogger();

            Log.Logger.ForContext("info", new HttpRequestInfo { Path = "/hello"}, true)
                .Error("boom");

output sample:

[20:44:52 ERR] <s:> boom
{"info": {"Path": {"Value": "/hello", "HasValue": true, "$type": "PathString"} "$type": "HttpRequestInfo"}}
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

No branches or pull requests

1 participant