Class: PostHog::PrefixedLogger Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wraps an existing logger and adds a prefix to all messages.

Instance Method Summary collapse

Constructor Details

#initialize(logger, prefix) ⇒ PrefixedLogger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PrefixedLogger.

Parameters:



12
13
14
15
# File 'lib/posthog/logging.rb', line 12

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

Instance Method Details

#debug(msg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

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

#error(msg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/posthog/logging.rb', line 29

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

#info(msg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

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

#levelObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def level
  @logger.level
end

#level=(severity) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
# File 'lib/posthog/logging.rb', line 33

def level=(severity)
  @logger.level = severity
end

#warn(msg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/posthog/logging.rb', line 25

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