Class: Semlogr::LoggerConfiguration
- Inherits:
-
Object
- Object
- Semlogr::LoggerConfiguration
- Defined in:
- lib/semlogr/logger_configuration.rb
Instance Attribute Summary collapse
-
#enrichers ⇒ Object
readonly
Returns the value of attribute enrichers.
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#min_severity ⇒ Object
readonly
Returns the value of attribute min_severity.
-
#sinks ⇒ Object
readonly
Returns the value of attribute sinks.
Instance Method Summary collapse
- #create_logger ⇒ Object
- #enrich_with(enricher) ⇒ Object
- #filter_when(filter) ⇒ Object
-
#initialize ⇒ LoggerConfiguration
constructor
A new instance of LoggerConfiguration.
- #log_at(severity) ⇒ Object
- #write_to(sink) ⇒ Object
Constructor Details
#initialize ⇒ LoggerConfiguration
Returns a new instance of LoggerConfiguration.
8 9 10 11 12 13 |
# File 'lib/semlogr/logger_configuration.rb', line 8 def initialize @min_severity = LogSeverity::DEBUG @enrichers = [] @filters = [] @sinks = [] end |
Instance Attribute Details
#enrichers ⇒ Object (readonly)
Returns the value of attribute enrichers.
4 5 6 |
# File 'lib/semlogr/logger_configuration.rb', line 4 def enrichers @enrichers end |
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
5 6 7 |
# File 'lib/semlogr/logger_configuration.rb', line 5 def filters @filters end |
#min_severity ⇒ Object (readonly)
Returns the value of attribute min_severity.
3 4 5 |
# File 'lib/semlogr/logger_configuration.rb', line 3 def min_severity @min_severity end |
#sinks ⇒ Object (readonly)
Returns the value of attribute sinks.
6 7 8 |
# File 'lib/semlogr/logger_configuration.rb', line 6 def sinks @sinks end |
Instance Method Details
#create_logger ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/semlogr/logger_configuration.rb', line 31 def create_logger Logger.new( @min_severity, @enrichers, @filters, @sinks ) end |
#enrich_with(enricher) ⇒ Object
23 24 25 |
# File 'lib/semlogr/logger_configuration.rb', line 23 def enrich_with(enricher) @enrichers << enricher end |
#filter_when(filter) ⇒ Object
19 20 21 |
# File 'lib/semlogr/logger_configuration.rb', line 19 def filter_when(filter) @filters << filter end |
#log_at(severity) ⇒ Object
15 16 17 |
# File 'lib/semlogr/logger_configuration.rb', line 15 def log_at(severity) @min_severity = severity end |
#write_to(sink) ⇒ Object
27 28 29 |
# File 'lib/semlogr/logger_configuration.rb', line 27 def write_to(sink) @sinks << sink end |