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

Bug | BasicLogger Panics When len(keyvals) is 1 #857

Closed
wants to merge 1 commit into from

Conversation

vicluq
Copy link

@vicluq vicluq commented Nov 6, 2024

refer to issue #856

@twmb
Copy link
Owner

twmb commented Nov 11, 2024

It's not a bug to panic when an API contract is violated. I may merge this, but I'm undecided -- forcing a panic has allowed me to repeatedly catch problems in development when I did have a bug by not passing key/value pairs.

@vicluq
Copy link
Author

vicluq commented Nov 16, 2024

It's not a bug to panic when an API contract is violated. I may merge this, but I'm undecided -- forcing a panic has allowed me to repeatedly catch problems in development when I did have a bug by not passing key/value pairs.

I understand, but that might not seem very user friendly, if you have a feature for EXTRA fields that works with an even number of arguments, it would make sense for it to act this way even with one argument. Another idea could be to improve the error message to make it clear that the problem was that a key/value pair was not passed.

@twmb
Copy link
Owner

twmb commented Jan 15, 2025

What do you think about changing the output to indicate there is extra output, similar to fmt (i.e. a cleaned up format of the current message)?

@twmb twmb added the patch label Jan 15, 2025
This was referenced Jan 15, 2025
@twmb
Copy link
Owner

twmb commented Feb 4, 2025

Let me know if you'd like to address the change and we can reopen & merge.

@twmb twmb closed this Feb 4, 2025
@vicluq
Copy link
Author

vicluq commented Feb 7, 2025

Let me know if you'd like to address the change and we can reopen & merge.

Hello! Sorry for the response delay. You have already provided such output, as stated in the issued I have opened, but it does not work if I only have a keyvals length of 1. With the small change I make, a tiny check to the keyvals size, it worked as you mentioned, displaying that single value as an EXTRA - the expected behaviour I have mentioned below.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants