Sha256: 274e78c47e03687b2018bd6cea4d8fcade7c7f424f28d5cc861038fecfda4faa

Contents?: true

Size: 671 Bytes

Versions: 74

Compression:

Stored size: 671 Bytes

Contents

module Dynflow
  module LoggerAdapters
    module Formatters
      class Abstract
        def initialize(base)
          @base = base
        end

        [:fatal, :error, :warn, :info, :debug].each do |method|
          define_method method do |message, &block|
            if block
              @base.send method, &-> { format(block.call) }
            else
              @base.send method, format(message)
            end
          end
        end

        def level=(v)
          @base.level = v
        end

        def level
          @base.level
        end

        def format(message)
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
dynflow-0.8.34 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.33 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.32 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.31 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.30 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.29 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.28 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.27 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.26 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.25 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.24 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.23 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.22 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.21 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.20 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.19 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.18 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.17 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.16 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.15 lib/dynflow/logger_adapters/formatters/abstract.rb