Class: Mebla::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/mebla/log_subscriber.rb

Overview

Handles logging

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.loggerLogger

Returns the main logger for Mebla

Returns:

  • (Logger)


70
71
72
# File 'lib/mebla/log_subscriber.rb', line 70

def self.logger
  Mebla::Configuration.instance.logger
end

Instance Method Details

#debug_green(msg) ⇒ Object

Print a debug message to the log file



44
45
46
# File 'lib/mebla/log_subscriber.rb', line 44

def debug_green(msg)
  debug color(msg, LogSubscriber::GREEN)
end

#error_red(msg) ⇒ Object

Print an error message to the log file



49
50
51
# File 'lib/mebla/log_subscriber.rb', line 49

def error_red(msg)
  error color(msg, LogSubscriber::RED)
end

#fatal_magenta(msg) ⇒ Object

Print a fatal message to the log file



59
60
61
# File 'lib/mebla/log_subscriber.rb', line 59

def fatal_magenta(msg)
  fatal color(msg, LogSubscriber::MAGENTA)
end

#info_blue(msg) ⇒ Object

Print an info message to the log file



54
55
56
# File 'lib/mebla/log_subscriber.rb', line 54

def info_blue(msg)
  info color(msg, LogSubscriber::BLUE)
end

#mebla_debug(event) ⇒ Object

Debug message



8
9
10
# File 'lib/mebla/log_subscriber.rb', line 8

def mebla_debug(event)
  debug_green event.payload[:message]      
end

#mebla_error(event) ⇒ Object

Error message



13
14
15
# File 'lib/mebla/log_subscriber.rb', line 13

def mebla_error(event)
  error_red event.payload[:message]      
end

#mebla_fatal(event) ⇒ Object

Fatal message



23
24
25
# File 'lib/mebla/log_subscriber.rb', line 23

def mebla_fatal(event)
  fatal_magenta event.payload[:message]      
end

#mebla_info(event) ⇒ Object

Info message



18
19
20
# File 'lib/mebla/log_subscriber.rb', line 18

def mebla_info(event)
  info_blue event.payload[:message]      
end

#mebla_unknown(event) ⇒ Object

Unknown message



33
34
35
# File 'lib/mebla/log_subscriber.rb', line 33

def mebla_unknown(event)
  unknown event.payload[:message]      
end

#mebla_warn(event) ⇒ Object

Warning message



28
29
30
# File 'lib/mebla/log_subscriber.rb', line 28

def mebla_warn(event)
  warn_yellow event.payload[:message]      
end

#warn_yellow(msg) ⇒ Object

Print a warn message to the log file



64
65
66
# File 'lib/mebla/log_subscriber.rb', line 64

def warn_yellow(msg)
  warn color(msg, LogSubscriber::YELLOW)
end