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.



9
10
11
12
# File 'lib/segment/analytics/logging.rb', line 9

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

Instance Method Details

#debug(msg) ⇒ Object



14
15
16
# File 'lib/segment/analytics/logging.rb', line 14

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

#error(msg) ⇒ Object



26
27
28
# File 'lib/segment/analytics/logging.rb', line 26

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

#info(msg) ⇒ Object



18
19
20
# File 'lib/segment/analytics/logging.rb', line 18

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

#warn(msg) ⇒ Object



22
23
24
# File 'lib/segment/analytics/logging.rb', line 22

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