Sha256: f1136f433c84df84d90622b44a03f14fa9ae2bf389c3a6994a703a0dd5dcc505

Contents?: true

Size: 385 Bytes

Versions: 12

Compression:

Stored size: 385 Bytes

Contents

module EsReadModel

  class Logger

    def call(ctx)
      ctx = {
        time: Time.now
      }.merge(ctx)
      extras = ENV.select {|k,v| k =~ /^readmodel/i }
      ctx = ctx.merge(extras)
      STDERR.puts ctx.map {|k,v| format(k, v.to_s) }.join(' ')
    end

    private

    def format(k, v)
      value = (v =~ / /) ? "\"#{v}\"" : v
      "#{k}=#{value}"
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
es-readmodel-1.0.2 lib/es_readmodel/logger.rb
es-readmodel-1.0.1 lib/es_readmodel/logger.rb
es-readmodel-1.0.0 lib/es_readmodel/logger.rb
es-readmodel-0.1.0 lib/es_readmodel/logger.rb
es-readmodel-0.0.10 lib/es_readmodel/logger.rb
es-readmodel-0.0.9 lib/es_readmodel/logger.rb
es-readmodel-0.0.8 lib/es_readmodel/logger.rb
es-readmodel-0.0.7 lib/es_readmodel/logger.rb
es-readmodel-0.0.6 lib/es_readmodel/logger.rb
es-readmodel-0.0.5 lib/es_readmodel/logger.rb
es-readmodel-0.0.4 lib/es_readmodel/logger.rb
es-readmodel-0.0.1 lib/es_readmodel/logger.rb