Class: PostHog::PrefixedLogger Private
- Inherits:
-
Object
- Object
- PostHog::PrefixedLogger
- 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
- #debug(msg) ⇒ Object private
- #error(msg) ⇒ Object private
- #info(msg) ⇒ Object private
-
#initialize(logger, prefix) ⇒ PrefixedLogger
constructor
private
A new instance of PrefixedLogger.
- #level ⇒ Object private
- #level=(severity) ⇒ Object private
- #warn(msg) ⇒ Object private
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.
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 |
#level ⇒ 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.
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 |