Module: Wallaby::Logger

Defined in:
lib/wallaby/logger.rb

Overview

Custom logger

Class Method Summary collapse

Class Method Details

.hint(key, message_or_config, replacements = {}) ⇒ Object

Examples:

to disable a particular hint message:

Wallaby::Logger.hint(:customize_controller, false) if Wallaby::Logger.debug?

Parameters:

  • key (Symbol, String)
  • message_or_config (String, false)
  • replacements (Hash) (defaults to: {})


27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/wallaby/logger.rb', line 27

def hint(key, message_or_config, replacements = {})
  @hint ||= {}
  return @hint[key] = false if message_or_config == false
  return if @hint[key] == false || !message_or_config.is_a?(String)

  new_message = <<~MESSAGE
    #{message_or_config}
    This kind of debug message can be disabled in `config/initializers/wallaby.rb`:

      Wallaby::Logger.hint(#{key.inspect}, false) if Wallaby::Logger.debug?
  MESSAGE
  debug(new_message, replacements.merge(sourcing: false))
end