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

devices: Use slog instead of logrus #32469

Merged
merged 2 commits into from May 13, 2024

Conversation

joamaki
Copy link
Contributor

@joamaki joamaki commented May 10, 2024

Let's get the ball rolling on the logrus=>slog migration!

First commit adds "logfields.Error" to use with e.g. log.Error("oops", logfields.Error, err).
Second commit refactors DevicesController to use slog instead of logrus.

@joamaki joamaki requested review from a team as code owners May 10, 2024 14:31
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 10, 2024
@joamaki joamaki added the release-note/misc This PR makes changes that have no direct user impact. label May 10, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 10, 2024
Copy link
Contributor

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@joamaki Nice! Thank you for starting the migration...

With the conversion to slog we no longer have WithError() and
thus need a logfield for errors.

Before:

  var log logrus.FieldLogger
  var err error
  log.WithError(err).Error("oops")

After:

  var log *slog.Logger
  var err error
  log.Error("oops", logfields.Error, err)

Signed-off-by: Jussi Maki <[email protected]>
Use the slog.Logger in DevicesController for logging.

Signed-off-by: Jussi Maki <[email protected]>
@joamaki joamaki force-pushed the pr/joamaki/devices-controller-slog branch from 611593b to da32bd8 Compare May 10, 2024 17:45
@joamaki
Copy link
Contributor Author

joamaki commented May 10, 2024

/test

@joamaki joamaki added this pull request to the merge queue May 13, 2024
Merged via the queue into cilium:main with commit 18ed625 May 13, 2024
63 of 64 checks passed
@joamaki joamaki deleted the pr/joamaki/devices-controller-slog branch May 13, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants