-
Notifications
You must be signed in to change notification settings - Fork 635
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
Propagate all logging fields to the tty logger #2233
Conversation
a834728
to
4643592
Compare
I made one more change to replace the if !logger.IsLevelEnabled(lv) {
return
}
// …
if lv <= logrus.FatalLevel {
entry = entry.WithField("level", lv)
lv = logrus.ErrorLevel
}
entry.Log(lv, header+j.Msg) |
@AkihiroSuda Speaking of comments, I think this line could use some explanation:
It seems to be added by 21b7cb0 to control logging for It is not clear to me why this is needed; I assume if there is still a backlog of unprocessed log messages from before the |
4643592
to
3c8d5b0
Compare
I just realized that there are tests in I don't plan on changing anything else but the tests though, so feel free to review the draft code in case you have any feedback! |
3c8d5b0
to
9dc45d3
Compare
I added the tests and took it out of draft; I think it is good now. |
9dc45d3
to
90f2f8c
Compare
The fields are serialized in JSON by the hostagent and then printed by the `limactl start` command to the console, so need to be explicitly added back to the logger entry. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
90f2f8c
to
de35e2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
The fields are serialized in JSON by the hostagent and then printed by the
limactl start
command to the console, so need to be explicitly added back to the logger entry.This PR is in response to #2228 (comment).
Note that nested structures (like
events.Event
) will be flattened by the standard logger, e.g.will result in
WARN[0020] [hostagent] Log message with error error=oops events="map[status:map[errors:[Error one Error two] running:true] time:0001-01-01T00:00:00Z]"
The change to
qemu_driver.go
is needed to avoid the ugly<nil>
error in@balajiv113 Your inotify PR has additional logging entries with duplicate
err
which should be changed if this PR is accepted/merged: