Replies: 3 comments
-
Correct, |
Beta Was this translation helpful? Give feedback.
-
Would treating keyword arguments and positional arguments differently be an option? E.g.: positional arguments: SemanticLogger['a'].error({ payload: '', foo: 'bar' })
# same as:
SemanticLogger['a'].error(payload: { payload: '', foo: 'bar' }) keyword arguments: SemanticLogger['a'].error(payload: '', foo: 'bar')
# raises error I guess this might be a breaking change though |
Beta Was this translation helpful? Give feedback.
-
I was just bitten by this in a way that felt very much like incorrect behavior. My code (using log_params = { subject: 'foo', payload: }
Rails.logger.info("my message", log_params) Adding the key The difference in how I'm calling the logger here felt different enough from the original example that it seemed worth verifying if this behavior is intended in the case of positional arguments as well. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Environment
Expected Behavior
I'd expect SemanticLogger to be fully compatible with
::Logger
, so I'd expect no error to be raised.Perhaps detecting it's an arbitrary hash and considering it as a message (i.e. treat it the same as
logger.error(message: { payload: '', foo: 'bar' })
and maybe also raise a warning pointing to bad use ofpayload
keyword) would be a good choice.Actual Behavior
stacktrace:
Note: this happened on a real codebase when I was installing
rails_semantic_logger
in our project. I had a change similar to the following to fix it:Beta Was this translation helpful? Give feedback.
All reactions