Class: Rox::Core::Analytics::PrefixedLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/rox/core/analytics/logging.rb

Overview

Wraps an existing logger and adds a prefix to all messages

Instance Method Summary collapse

Constructor Details

#initialize(logger, prefix) ⇒ PrefixedLogger

Returns a new instance of PrefixedLogger.



8
9
10
11
# File 'lib/rox/core/analytics/logging.rb', line 8

def initialize(logger, prefix)
  @logger = logger
  @prefix = prefix
end

Instance Method Details

#debug(msg) ⇒ Object



13
14
15
# File 'lib/rox/core/analytics/logging.rb', line 13

def debug(msg)
  @logger.debug("#{@prefix} #{msg}")
end

#error(msg) ⇒ Object



25
26
27
# File 'lib/rox/core/analytics/logging.rb', line 25

def error(msg)
  @logger.error("#{@prefix} #{msg}")
end

#info(msg) ⇒ Object



17
18
19
# File 'lib/rox/core/analytics/logging.rb', line 17

def info(msg)
  @logger.info("#{@prefix} #{msg}")
end

#warn(msg) ⇒ Object



21
22
23
# File 'lib/rox/core/analytics/logging.rb', line 21

def warn(msg)
  @logger.warn("#{@prefix} #{msg}")
end