Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Enhance logging #233

Merged
merged 16 commits into from
Jun 13, 2023
Merged

Conversation

thepetk
Copy link
Collaborator

@thepetk thepetk commented Jun 4, 2023

What does this PR do?

Creates the --log CLI argument for all command and adds logging to all three commands (devfile, component and analyze). This argument accepts only three values (warning, debug, info). In case of absence the zapcore.ErrorLevel is selected and in case of wrong level an error is raised.

The V-levels have been used in order to separate debug level logs from info etc.

Additionally, it introduces the utils.logger functionality. Inside this file we are declaring a global variable called CliLogger which initially is not initialized. Each time that we want to use the logger inside alizer we have to utils.GetOrCreateLogger, in order to be able to use the same level of logging all the time.

Every time that we want to generate a new logger, we check the given logging level and we are creating a new zap logger (logr.Logger).

Which issue(s) does this PR fix

fixes #153

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

thepetk added 11 commits June 3, 2023 19:36
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
@thepetk thepetk requested a review from mike-hoang June 4, 2023 01:03
@thepetk thepetk self-assigned this Jun 4, 2023
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
go/pkg/utils/logger.go Fixed Show fixed Hide fixed
thepetk added 2 commits June 13, 2023 12:56
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
@thepetk thepetk requested a review from mike-hoang June 13, 2023 13:52
@mike-hoang mike-hoang merged commit 835b552 into redhat-developer:main Jun 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance logging on go implementation
2 participants