Class: Nutella::NutellaLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/logging/nutella_logger.rb

Direct Known Subclasses

NutellaLoggerRemote

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ NutellaLogger

Returns a new instance of NutellaLogger.



8
9
10
11
12
13
14
# File 'lib/logging/nutella_logger.rb', line 8

def initialize(name)
  @log = Logging.logger[name]
  @log.add_appenders(Logging.appenders.stdout(
    :layout => Logging.layouts.pattern(:pattern => '%m\n')
    )
  )
end

Instance Method Details

#debug(message, code = nil) ⇒ Object



16
17
18
19
# File 'lib/logging/nutella_logger.rb', line 16

def debug(message, code=nil)
  @log.debug(ANSI.cyan + message + ANSI.reset)
  code
end

#error(message, code = nil) ⇒ Object



36
37
38
39
# File 'lib/logging/nutella_logger.rb', line 36

def error(message, code=nil)
  @log.error(ANSI.red + message + ANSI.reset)
  code
end

#info(message, code = nil) ⇒ Object



21
22
23
24
# File 'lib/logging/nutella_logger.rb', line 21

def info(message, code=nil)
  @log.info(message)
  code
end

#success(message, code = nil) ⇒ Object



26
27
28
29
# File 'lib/logging/nutella_logger.rb', line 26

def success(message, code=nil)
  @log.info(ANSI.green + message + ANSI.reset)
  code
end

#warn(message, code = nil) ⇒ Object



31
32
33
34
# File 'lib/logging/nutella_logger.rb', line 31

def warn(message, code=nil)
  @log.warn(ANSI.yellow + message + ANSI.reset)
  code
end