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

use zap.NewDevelopmentConfig to setup logger #85

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

mansam
Copy link
Contributor

@mansam mansam commented Jun 17, 2024

What does this PR do?

The Zap library provides a logger config that can be used without pulling in controller-runtime as a dependency. Since alizer is only using a few options, the dependency on controller-runtime can be avoided by setting it up directly using zap's NewDevelopmentConfig (which sets the development flag and the ISO8601 time encoder), and setting the log level on that.

(this scratches an itch for me as the k8s dependency is complicating some of my builds)

Which issue(s) does this PR fix

devfile/api#1581

PR acceptance criteria

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Unit/Functional tests

  • Documentation

How to test changes / Special notes to the reviewer

I did a visual inspection of the log output to check that the format appears to be the same.

Copy link
Contributor

@thepetk thepetk left a comment

Choose a reason for hiding this comment

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

nice addition :)

/ok-to-test

@thepetk
Copy link
Contributor

thepetk commented Jun 18, 2024

@mansam could you please rebase your branch on the latest changes?

@mansam
Copy link
Contributor Author

mansam commented Jun 18, 2024

@thepetk done :)

The Zap library provides a logger config that can
be used without pulling in controller-runtime as a
dependency. Since alizer is only using a few options,
the dependency on controller-runtime can be avoided
by using zap's NewDevelopmentConfig (which sets
the development flag and the ISO8601 time encoder),
and setting the log level on that.

Signed-off-by: Sam Lucidi <slucidi@redhat.com>
Copy link
Contributor

@Jdubrick Jdubrick left a comment

Choose a reason for hiding this comment

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

Great changes!

Copy link
Contributor

@thepetk thepetk left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link

openshift-ci bot commented Jun 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jdubrick, mansam, thepetk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@thepetk thepetk merged commit ad40975 into devfile:main Jun 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants