Class: Smplkit::Logging::LoggerSource
- Inherits:
-
Object
- Object
- Smplkit::Logging::LoggerSource
- Defined in:
- lib/smplkit/logging/sources.rb
Overview
Describes a logger to register via Smplkit::ManagementClient#loggers#register.
Used both for buffered runtime discovery (called by Smplkit::Client as adapters discover loggers) and for explicit registration from setup scripts that already know the (service, environment) they belong to.
Args:
- name: Logger name (e.g. +"sqlalchemy.engine"+). Normalized to
lowercase with slashes and colons replaced by dots before sending to
the API.
- resolved_level: Effective log level for this source.
- level: Explicit (configured) log level, if different from
+resolved_level+. Pass +nil+ when the level is inherited.
- service: Service name this source belongs to (optional).
- environment: Environment name this source belongs to (optional).
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resolved_level ⇒ Object
readonly
Returns the value of attribute resolved_level.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, resolved_level:, level: nil, service: nil, environment: nil) ⇒ LoggerSource
constructor
A new instance of LoggerSource.
Constructor Details
#initialize(name:, resolved_level:, level: nil, service: nil, environment: nil) ⇒ LoggerSource
Returns a new instance of LoggerSource.
23 24 25 26 27 28 29 30 |
# File 'lib/smplkit/logging/sources.rb', line 23 def initialize(name:, resolved_level:, level: nil, service: nil, environment: nil) @name = name @resolved_level = resolved_level @level = level @service = service @environment = environment freeze end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
21 22 23 |
# File 'lib/smplkit/logging/sources.rb', line 21 def environment @environment end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
21 22 23 |
# File 'lib/smplkit/logging/sources.rb', line 21 def level @level end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/smplkit/logging/sources.rb', line 21 def name @name end |
#resolved_level ⇒ Object (readonly)
Returns the value of attribute resolved_level.
21 22 23 |
# File 'lib/smplkit/logging/sources.rb', line 21 def resolved_level @resolved_level end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
21 22 23 |
# File 'lib/smplkit/logging/sources.rb', line 21 def service @service end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
32 33 34 35 |
# File 'lib/smplkit/logging/sources.rb', line 32 def ==(other) other.is_a?(LoggerSource) && name == other.name && resolved_level == other.resolved_level && level == other.level && service == other.service && environment == other.environment end |
#hash ⇒ Object
38 |
# File 'lib/smplkit/logging/sources.rb', line 38 def hash = [name, resolved_level, level, service, environment].hash |