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: Get rid of the <nil> fields in all log outputs #716

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

mkilchhofer
Copy link
Contributor

@mkilchhofer mkilchhofer commented Jan 19, 2024

Fixes #715

Before change (status quo)

env NEBRASKA_LOG_FORMAT unset

<nil> DBG Unknown format context=api logFormat=
<nil> DBG Unknown format context=nebraska logFormat=
<nil> DBG Unknown format context=auth logFormat=
<nil> DBG Unknown format context=omaha logFormat=
<nil> DBG Unknown format context=nebraska logFormat=
<nil> DBG Unknown format context=nebraska logFormat=
<nil> DBG Unknown format context=syncer logFormat=

   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.10.2
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8000

env NEBRASKA_LOG_FORMAT=pretty

<nil> DBG Unknown format context=api logFormat=pretty
<nil> DBG Unknown format context=nebraska logFormat=pretty
<nil> DBG Unknown format context=auth logFormat=pretty
<nil> DBG Unknown format context=omaha logFormat=pretty
<nil> DBG Unknown format context=nebraska logFormat=pretty
<nil> DBG Unknown format context=nebraska logFormat=pretty
<nil> DBG Unknown format context=syncer logFormat=pretty

   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.10.2
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8000

env NEBRASKA_LOG_FORMAT=json


   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.10.2
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8000
{"level":"info","machineId":"aaaa671d61774703ac7be60715220baa","appID":"e96281a6-d1af-4bde-9a0a-97b76e56dc57","group":"5b810680-e36a-4879-b98a-4f989e80b899","event":"update complete.success","previousVersion":"","context":"omaha","message":"processEvent eventError 0"}

After this change

env NEBRASKA_LOG_FORMAT unset

2024-01-21T10:57:30+01:00 DBG Unknown format context=api logFormat=
2024-01-21T10:57:30+01:00 DBG Unknown format context=nebraska logFormat=
2024-01-21T10:57:30+01:00 DBG Unknown format context=auth logFormat=
2024-01-21T10:57:30+01:00 DBG Unknown format context=omaha logFormat=
2024-01-21T10:57:30+01:00 DBG Unknown format context=nebraska logFormat=
2024-01-21T10:57:30+01:00 DBG Unknown format context=nebraska logFormat=
2024-01-21T10:57:30+01:00 DBG Unknown format context=syncer logFormat=

   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.10.2
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8000

env NEBRASKA_LOG_FORMAT=pretty

2024-01-21T11:17:25+01:00 DBG Unknown format context=api logFormat=pretty
2024-01-21T11:17:25+01:00 DBG Unknown format context=nebraska logFormat=pretty
2024-01-21T11:17:25+01:00 DBG Unknown format context=auth logFormat=pretty
2024-01-21T11:17:25+01:00 DBG Unknown format context=omaha logFormat=pretty
2024-01-21T11:17:25+01:00 DBG Unknown format context=nebraska logFormat=pretty
2024-01-21T11:17:25+01:00 DBG Unknown format context=nebraska logFormat=pretty
2024-01-21T11:17:25+01:00 DBG Unknown format context=syncer logFormat=pretty

   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.10.2
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8000
2024-01-21T11:17:27+01:00 INF processEvent eventError 0 appID=e96281a6-d1af-4bde-9a0a-97b76e56dc57 context=omaha event="update complete.success" group=5b810680-e36a-4879-b98a-4f989e80b899 machineId=aaaa671d61774703ac7be60715220baa previousVersion=

env NEBRASKA_LOG_FORMAT=json


   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.10.2
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8000
{"level":"info","machineId":"aaaa671d61774703ac7be60715220baa","appID":"e96281a6-d1af-4bde-9a0a-97b76e56dc57","group":"5b810680-e36a-4879-b98a-4f989e80b899","event":"update complete.success","previousVersion":"","time":"2024-01-21T10:58:28+01:00","context":"omaha","message":"processEvent eventError 0"}

@mkilchhofer mkilchhofer marked this pull request as ready for review January 21, 2024 10:16
@dongsupark dongsupark requested a review from a team March 4, 2024 10:09
Copy link
Member

@dongsupark dongsupark left a comment

Choose a reason for hiding this comment

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

Looks good. Tested locally, and it works well.
Thank you for your contribution!

@dongsupark dongsupark merged commit d781877 into flatcar:main Mar 5, 2024
2 checks passed
@mkilchhofer mkilchhofer deleted the bugfix/timestamp_log_nil branch March 5, 2024 14:12
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.

Every log line starts with <nil> (with default logger config)
2 participants