Skip to content

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