-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
JsonLayout #481
JsonLayout #481
Conversation
Thanks for the pull request I'll take a look at it |
Hi, First of all, I think this is a great addition to NLog. I have a question about nested JSON objects. Is this intended only of key value pairs? Can we nest our own JSON? Something like a property bag that we serialize and add to event-context. As far as i can see all attributes are not json-encoded. That means that attributes that are already valid JSON will get escaped where that is not needed or am i missing something? Best, |
Hi, What do you mean with :
So far I know, everything is encoded with the I think other objects besides key-value pairs would be nice. Please create a new issue for this feature request if you like. Also an (config) example would be nice. |
Sorry, tipo :) I have forked the project and implemented a small change. I have added encode attribute on JsonAttribute so that user can control if output should be encoded. Setting this to false will enable user to add arbitrary JSON into context. I'm still missing some tests, but can eventually create a pull request if you find it interesting. |
I find it interesting 👍 PR is welcome, but I does need some unit tests (and examples for the documentation) |
Ok. Great, I will try to get that done as soon as possible. |
A new layout that renders log events as structured JSON documents.
The implementation and setup are similar to the CsvLayout: