Sha256: 0fab63524d555a9ae3b5eae7ae520ede546eea9c3771baa9f7c0992b2f57758e
Contents?: true
Size: 797 Bytes
Versions: 31
Compression:
Stored size: 797 Bytes
Contents
# Use the Ruby/Rails logger require 'active_support/core_ext/logger' require "securerandom" module Middleman # The Middleman Logger class Logger < ::Logger # Force output to STDOUT 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 def call(message, *args) return if @instrumenting.is_a?(String) && @instrumenting != "instrument" && !message.include?(@instrumenting) evt = ActiveSupport::Notifications::Event.new(message, *args) self.info "== Instrument (#{evt.name.sub(/.middleman$/, '')}): #{evt.duration}ms" end end end
Version data entries
31 entries across 31 versions & 2 rubygems