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

Added ApplicationInsightsPropertyFormatter for flattening complex properties #14

Merged
merged 1 commit into from Jun 15, 2016

Conversation

olegKoshmeliuk
Copy link
Contributor

Implemented new behavior for AI custom properties for better integration with Analytics queries
Fix for #13

Example:

logger.Information("Got request:{@string} and {@dto} ", "[\"string\"]",
                new
                {
                    number = 1,
                    list = new object[] {1, "test"},
                    inner = new {a = "a", b = "b"},
                });
//Will produce 

Old behavior:

{
  "LogLevel": "Information",
  "RenderedMessage": "Got request:\"[\\\"string\\\"]\" and { number: 1, list: [1, \"test\"], inner: { a: \"a\", b: \"b\" } }",
  "string": "\"[\\\"string\\\"]\"",
  "dto": "{ number: 1, list: [1, \"test\"], inner: { a: \"a\", b: \"b\" } }"
}

New behavior:

{
  "LogLevel": "Information",
  "MessageTemplate": "Got request:{@string} and {@dto}",
  "RenderedMessage": "Got request:\"[\\\"string\\\"]\" and { number: 1, list: [1, \"test\"], inner: { a: \"a\", b: \"b\" } }",
  "string": "[\"string\"]",
  "dto.number": "1",
  "dto.list.0": "1",
  "dto.list.1": "test",
  "dto.list.Count": "2",
  "dto.inner.a": "a",
  "dto.inner.b": "b"
}

@joergbattermann joergbattermann merged commit 2030bcc into serilog-contrib:master Jun 15, 2016
@joergbattermann
Copy link
Contributor

LGTM 👍 Thanks a lot @olegKoshmeliuk !!

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.

None yet

2 participants