Class: Arsenicum::Configuration::LoggerConfiguration
- Inherits:
-
Object
- Object
- Arsenicum::Configuration::LoggerConfiguration
- Defined in:
- lib/arsenicum/configuration.rb
Instance Attribute Summary collapse
-
#log_format ⇒ Object
readonly
Returns the value of attribute log_format.
-
#log_level ⇒ Object
readonly
Returns the value of attribute log_level.
-
#log_path ⇒ Object
readonly
Returns the value of attribute log_path.
Instance Method Summary collapse
- #build ⇒ Object
- #format(&format) ⇒ Object
-
#initialize ⇒ LoggerConfiguration
constructor
A new instance of LoggerConfiguration.
- #level(level) ⇒ Object
- #path(path) ⇒ Object
Constructor Details
#initialize ⇒ LoggerConfiguration
Returns a new instance of LoggerConfiguration.
136 137 138 139 |
# File 'lib/arsenicum/configuration.rb', line 136 def initialize @log_path = STDOUT @log_level = :info end |
Instance Attribute Details
#log_format ⇒ Object (readonly)
Returns the value of attribute log_format.
134 135 136 |
# File 'lib/arsenicum/configuration.rb', line 134 def log_format @log_format end |
#log_level ⇒ Object (readonly)
Returns the value of attribute log_level.
134 135 136 |
# File 'lib/arsenicum/configuration.rb', line 134 def log_level @log_level end |
#log_path ⇒ Object (readonly)
Returns the value of attribute log_path.
134 135 136 |
# File 'lib/arsenicum/configuration.rb', line 134 def log_path @log_path end |
Instance Method Details
#build ⇒ Object
153 154 155 156 157 158 |
# File 'lib/arsenicum/configuration.rb', line 153 def build logger = ::Logger.new(output_stream.tap{|s|s.sync = true}) logger.level = ::Logger.const_get log_level.to_s.upcase.to_sym logger.formatter = log_format if log_format logger end |
#format(&format) ⇒ Object
149 150 151 |
# File 'lib/arsenicum/configuration.rb', line 149 def format &format @log_format = format end |
#level(level) ⇒ Object
145 146 147 |
# File 'lib/arsenicum/configuration.rb', line 145 def level level @log_level = level end |
#path(path) ⇒ Object
141 142 143 |
# File 'lib/arsenicum/configuration.rb', line 141 def path path @log_path = path end |