Class: Segment::Analytics::PrefixedLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/segment/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.



7
8
9
10
# File 'lib/segment/analytics/logging.rb', line 7

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

Instance Method Details

#debug(msg) ⇒ Object



12
13
14
# File 'lib/segment/analytics/logging.rb', line 12

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

#error(msg) ⇒ Object



24
25
26
# File 'lib/segment/analytics/logging.rb', line 24

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

#info(msg) ⇒ Object



16
17
18
# File 'lib/segment/analytics/logging.rb', line 16

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

#warn(msg) ⇒ Object



20
21
22
# File 'lib/segment/analytics/logging.rb', line 20

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