reidmorrison / semantic_logger

Semantic Logger is a feature rich logging framework, and replacement for existing Ruby & Rails loggers.
https://logger.rocketjob.io/
Apache License 2.0
873 stars 124 forks source link

Unexpected Behavior: Debug Logs returning false when default_level = :info #304

Open gugaiz opened 5 days ago

gugaiz commented 5 days ago

Environment

Description

I encountered an issue while using rails_semantic_logger in a Rails project with the Solidus framework. When SemanticLogger.default_level = :info or config.log_level = :info is set, debug-level logs return false, which leads to unexpected behavior.

Here’s a simplified example of the issue:

order = Spree::Order.first
order.logger.debug "Testing" # This output `false` while the original behavior is to return `true` even if log level is set to :info

This behavior affects the Solidus gem's state_machine logic, where debug logs are used in transition callbacks. For example:

after_transition do |order, transition|
  order.logger.debug "Order #{order.number} transitioned from #{transition.from} to #{transition.to} via #{transition.event}"
end

You can see this code in context here

When logs are set to :info, the state_machine process fails silently.

Context

Expected Behavior

Even when default_level or config.log_level is set to :info, calls to logger.debug should return true as it happens with the original ActiveSupport::Logger