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

Fix JSON when object is first to be pushed #154

Merged
merged 1 commit into from Jun 5, 2019
Merged

Conversation

IxDay
Copy link
Contributor

@IxDay IxDay commented May 27, 2019

When pushing an object to the logger, and this object was the first
field added. Zerolog was outputting an invalid json blob, issuing an
extra comma before the object. This patch ensure that JSON is still valid
even if an object is pushed first to the logger.

Fixes #152

// 1. new content starts with '{' - which shd be dropped OR
// 2. existing content has already other fields
// 2. new content starts with '{' - which shd be replaced with ',' to separate with existing content OR
Copy link
Owner

@rs rs May 27, 2019

Choose a reason for hiding this comment

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

shd -> should. Can you please fix the same typo on the line above too?

When pushing an object to the logger, and this object was the first
field added. Zerolog was outputting an invalid json blob, issuing an
extra comma before the object. This patch ensure that JSON is still valid
even if an object is pushed first to the logger.

Fixes rs#152
@rs rs merged commit 9938a23 into rs:master Jun 5, 2019
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.

Invalid json when using only an objet
2 participants