Skip to content

Conversation

@squizzi
Copy link
Contributor

@squizzi squizzi commented Feb 5, 2025

This adds a JSONFormatter based on the logrus.JSONFormatter implementation. It updates the existing tests where we test the ConsoleFormatter to test both formatters and adds a new test to test prefixing of fields.

The intent for this is to use this formatter for logging in vandoor, specifically in https://github.com/replicatedhq/vandoor/pull/6859

Signed-off-by: Kyle Squizzato <kyle@replicated.com>
@squizzi squizzi requested a review from divolgin February 5, 2025 22:57

// Configure default fields.
prefixDefaultFieldClashes(data)
data["timestamp"] = entry.Time.Format("2006/01/02 15:04:05")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we use this same time format or should we stick to something more JSON-y?

Copy link
Contributor

Choose a reason for hiding this comment

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

this looks ok to me

Signed-off-by: Kyle Squizzato <kyle@replicated.com>
@squizzi squizzi merged commit 642c0fe into main Feb 6, 2025
1 check passed
@squizzi squizzi deleted the squizzi/sc-115989/json-formatter branch February 6, 2025 03:45
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.

3 participants