Class: Middleman::Logger
- Inherits:
-
Logger
- Object
- Logger
- Middleman::Logger
- Defined in:
- lib/middleman-core/logger.rb
Overview
The Middleman Logger
Instance Method Summary collapse
- #call(message, *args) ⇒ Object
-
#initialize(log_level = 1, is_instrumenting = false, target = STDOUT) ⇒ Logger
constructor
Force output to STDOUT.
Constructor Details
#initialize(log_level = 1, is_instrumenting = false, target = STDOUT) ⇒ Logger
Force output to STDOUT
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/middleman-core/logger.rb', line 10 def initialize(log_level=1, is_instrumenting=false, target=STDOUT) super(STDOUT) self.level = log_level @instrumenting = is_instrumenting if @instrumenting != false ::ActiveSupport::Notifications.subscribe(/\.middleman$/, self) end end |
Instance Method Details
#call(message, *args) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/middleman-core/logger.rb', line 21 def call(, *args) return if @instrumenting.is_a?(String) && @instrumenting != "instrument" && !.include?(@instrumenting) evt = ActiveSupport::Notifications::Event.new(, *args) self.info "== Instrument (#{evt.name.sub(/.middleman$/, '')}): #{evt.duration}ms" end |