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

feat: add logger interface #17

Merged
merged 9 commits into from
Oct 27, 2023
Merged

feat: add logger interface #17

merged 9 commits into from
Oct 27, 2023

Conversation

aymanbagabas
Copy link
Member

Pass a custom logger to log messages

Copy link
Contributor

@KyleFromKitware KyleFromKitware left a comment

Choose a reason for hiding this comment

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

This is definitely an improvement. If you haven't already, I'd also suggest checking out logrus. It seems to be the de facto standard for logging in Go, and supports things like structured data. It's pluggable, you can use any logging backend you want with it. GitLab uses logrus, wrapped in their own wrapper.

@aymanbagabas
Copy link
Member Author

aymanbagabas commented Oct 26, 2023

This is definitely an improvement. If you haven't already, I'd also suggest checking out logrus. It seems to be the de facto standard for logging in Go, and supports things like structured data. It's pluggable, you can use any logging backend you want with it. GitLab uses logrus, wrapped in their own wrapper.

I would avoid using logrus since there are many different go loggers out there and each has its interface, plus it would bloat the package. Perhaps we could make this Logger interface structured instead

@KyleFromKitware
Copy link
Contributor

Perhaps we could make this Logger interface structured instead

Yes, I think that would be a good idea too, and then on GitLab's side we could simply add a Logrus backend for your Logger interface.

@KyleFromKitware
Copy link
Contributor

Cc: @ashmckenzie

Copy link
Contributor

@KyleFromKitware KyleFromKitware 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, one minor suggestion.

cmd.go Show resolved Hide resolved
@aymanbagabas aymanbagabas changed the base branch from args to master October 27, 2023 13:37
@codecov
Copy link

codecov bot commented Oct 27, 2023

We're currently processing your upload. This comment will be updated when the results are available.

@aymanbagabas aymanbagabas merged commit bb5f31e into master Oct 27, 2023
14 checks passed
@aymanbagabas aymanbagabas deleted the logger branch October 27, 2023 13:58
aymanbagabas added a commit that referenced this pull request Oct 27, 2023
@aymanbagabas aymanbagabas restored the logger branch October 27, 2023 13:59
@aymanbagabas aymanbagabas deleted the logger branch October 27, 2023 14:00
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.

2 participants