You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An ArgumentError is thrown, primarily from passing the log struct to the lambda that does not accept any arguments.
irb(main):001> x = lambda { "log message" }
=> #<Proc:0x00007b46b0d80a28 (irb):1 (lambda)>
irb(main):002> Rails.logger.info(&x)
(irb):1:in `block in <top (required)>': wrong number of arguments (given 1, expected 0) (ArgumentError)
from (irb):2:in `<main>'
Please note that some of our gems do this form of logging (logging with zero-arity lambdas), and monkey patching them is not an option.
The text was updated successfully, but these errors were encountered:
laythra
changed the title
Rails.logger doesn't support zero-arity lamdas and throws an ArgumentError
Rails.logger doesn't support zero-arity lambdas and throws an ArgumentError
Oct 19, 2024
Environment
Error Stack Trace:
Expected Behavior
For the string returned from the lambda to get logged properly
Current Behaviour
An ArgumentError is thrown, primarily from passing the log struct to the lambda that does not accept any arguments.
Please note that some of our gems do this form of logging (logging with zero-arity lambdas), and monkey patching them is not an option.
The text was updated successfully, but these errors were encountered: