Sha256: c7b3374e2312336e20ae8eaf004e5a0119ae607017c25e23d57147e8cacc3e90

Contents?: true

Size: 635 Bytes

Versions: 6

Compression:

Stored size: 635 Bytes

Contents

class Logasm
  module Adapters
    LOG_LEVELS = %w(debug info warn error fatal unknown).freeze

    def self.get(type, service_name, arguments)
      adapter =
        if type == 'stdout'
          if arguments.fetch(:json, false)
            require_relative 'adapters/stdout_json_adapter'
            StdoutJsonAdapter
          else
            require_relative 'adapters/stdout_adapter'
            StdoutAdapter
          end
        else
          raise "Unsupported logger: #{type}"
        end
      level = LOG_LEVELS.index(arguments.fetch(:level, 'debug'))
      adapter.new(level, service_name, arguments)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
logasm-jruby-1.2.1 lib/logasm/adapters.rb
logasm-1.2.1 lib/logasm/adapters.rb
logasm-jruby-1.2.0 lib/logasm/adapters.rb
logasm-1.2.0 lib/logasm/adapters.rb
logasm-1.1.0 lib/logasm/adapters.rb
logasm-1.0.0 lib/logasm/adapters.rb