Class: ScoutApm::Logging::Context

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

Overview

Contains context around Scout APM logging, such as environment, configuration, and the logger.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Initially start up without attempting to load a configuration file. We need to be able to lookup configuration options like “application_root” which would then in turn influence where the yaml configuration file is located

Later in initialization, we set config= to include the file.



16
17
18
# File 'lib/scout_apm/logging/context.rb', line 16

def initialize
  @logger = LoggerFactory.build_minimal_logger
end

Instance Attribute Details

#application_rootObject

The root of the application.



8
9
10
# File 'lib/scout_apm/logging/context.rb', line 8

def application_root
  @application_root
end

Instance Method Details

#configObject



20
21
22
# File 'lib/scout_apm/logging/context.rb', line 20

def config
  @config ||= Config.without_file(self)
end

#config=(config) ⇒ Object



32
33
34
35
36
# File 'lib/scout_apm/logging/context.rb', line 32

def config=(config)
  @config = config

  @logger = nil
end

#environmentObject



24
25
26
# File 'lib/scout_apm/logging/context.rb', line 24

def environment
  @environment ||= ScoutApm::Environment.instance
end

#loggerObject



28
29
30
# File 'lib/scout_apm/logging/context.rb', line 28

def logger
  @logger ||= LoggerFactory.build(config, environment, application_root)
end