Module: PostHog::Logging

Included in:
Client, FeatureFlagsPoller, MessageBatch, SendWorker, Transport
Defined in:
lib/posthog/logging.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.loggerObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/posthog/logging.rb', line 38

def logger
  return @logger if @logger

  base_logger =
    if defined?(Rails)
      Rails.logger
    else
      logger = Logger.new STDOUT
      logger.progname = 'PostHog'
      logger.level = Logger::WARN
      logger
    end
  @logger = PrefixedLogger.new(base_logger, '[posthog-ruby]')
end

Class Method Details

.included(base) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/posthog/logging.rb', line 56

def self.included(base)
  class << base
    def logger
      Logging.logger
    end
  end
end

Instance Method Details

#loggerObject



64
65
66
# File 'lib/posthog/logging.rb', line 64

def logger
  Logging.logger
end