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

Support logging data with nil exception #121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kcdragon
Copy link

Prior to this PR, if a log was written with a message and data but the exception field was explicitly nil, the data would not be included in the log. So in the following example

log.error("This is a message", nil, { key: 'value' })

"This is a message" would appear in the log but { key: 'value' } would not. I was expecting { key: 'value' } to be in the log.

This PR adds support for logging the data field with exception explicitly being set to nil. I know this is already supported by only using 2 parameters but it seems unintuitive that a nil exception would cause data to not be logged.

@tilfin
Copy link
Owner

tilfin commented Aug 29, 2021

I think it would be better to change the specification to remove nil in the arguments and apply them.
https://github.com/tilfin/ougai/pull/121/files#diff-d672d7d72aee3369fa48c1c9f7c23d546c44c3ebbf3301c63607da08287ea582
L119 msg, ex, data = args.reject(&:nil?)

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