Module: Alchemy::Logger

Defined in:
lib/alchemy/logger.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.debug(message) ⇒ Object

Logs a debug message to the Rails standard logger



6
7
8
9
10
11
# File 'lib/alchemy/logger.rb', line 6

def self.debug(message)
  Rails.logger.tagged("alchemy") do
    Rails.logger.debug(message)
  end
  nil
end

.error(message) ⇒ Object

Logs a error message to the Rails standard logger



14
15
16
17
18
19
# File 'lib/alchemy/logger.rb', line 14

def self.error(message)
  Rails.logger.tagged("alchemy") do
    Rails.logger.error("ERROR: #{message}")
  end
  nil
end

.info(message) ⇒ Object

Logs a info message to the Rails standard logger



22
23
24
25
26
27
# File 'lib/alchemy/logger.rb', line 22

def self.info(message)
  Rails.logger.tagged("alchemy") do
    Rails.logger.info(message)
  end
  nil
end

.warn(message, caller_string = nil) ⇒ Object

Logs a warning message to the Rails standard logger



30
31
32
33
34
35
36
37
38
# File 'lib/alchemy/logger.rb', line 30

def self.warn(message, caller_string = nil)
  if caller_string
    Alchemy::Deprecation.warn("Alchemy::Logger.warn second argument is deprecated and will be removed in Alchemy 9.0")
  end
  Rails.logger.tagged("alchemy") do
    Rails.logger.warn("WARNING: #{message}")
  end
  nil
end

Instance Method Details

#log_warning(message) ⇒ Object



40
41
42
# File 'lib/alchemy/logger.rb', line 40

def log_warning(message)
  Alchemy::Logger.warn(message)
end