Class: ScoutApm::Logging::Context
- Inherits:
-
Object
- Object
- ScoutApm::Logging::Context
- 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
-
#application_root ⇒ Object
The root of the application.
Instance Method Summary collapse
- #config ⇒ Object
- #config=(config) ⇒ Object
- #environment ⇒ Object
-
#initialize ⇒ Context
constructor
Initially start up without attempting to load a configuration file.
- #logger ⇒ Object
Constructor Details
#initialize ⇒ Context
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_root ⇒ Object
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
#config ⇒ Object
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 |
#environment ⇒ Object
24 25 26 |
# File 'lib/scout_apm/logging/context.rb', line 24 def environment @environment ||= ScoutApm::Environment.instance end |
#logger ⇒ Object
28 29 30 |
# File 'lib/scout_apm/logging/context.rb', line 28 def logger @logger ||= LoggerFactory.build(config, environment, application_root) end |