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-1.2.2 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.2.1 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.2.0 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.2.0.pre1 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.1.6 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.1.5 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.1.4 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.1.3 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.1.2 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.1.1 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.1.0 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.0.5 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.0.4 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.0.3 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.0.2 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.0.1 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-1.0.0 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.37 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.36 lib/dynflow/logger_adapters/formatters/abstract.rb
dynflow-0.8.35 lib/dynflow/logger_adapters/formatters/abstract.rb