Module: JLog::DSL
- Included in:
- JLog
- Defined in:
- lib/jlog/dsl.rb
Instance Method Summary collapse
- #configure(path = nil, &block) ⇒ Object
- #formatter(path) ⇒ Object
- #get_config(path) ⇒ Object
- #logger(path) ⇒ Object
Instance Method Details
#configure(path = nil, &block) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/jlog/dsl.rb', line 3 def configure(path = nil, &block) @configurations ||= {} config = Configuration.new @configurations[path] = config block.call(config) if block end |
#formatter(path) ⇒ Object
21 22 23 24 25 |
# File 'lib/jlog/dsl.rb', line 21 def formatter(path) config = get_config(path) return config.formatter if config Formatter::Default end |
#get_config(path) ⇒ Object
10 11 12 13 |
# File 'lib/jlog/dsl.rb', line 10 def get_config(path) return nil unless @configurations or @configurations[path] return @configurations[path] end |
#logger(path) ⇒ Object
15 16 17 18 19 |
# File 'lib/jlog/dsl.rb', line 15 def logger(path) config = get_config(path) return config.logger if config Rails.logger end |