Sha256: 14f1f9fd1feea23db135960b3bc91172b62b674a43ddd535b9b130a882204229
Contents?: true
Size: 653 Bytes
Versions: 2
Compression:
Stored size: 653 Bytes
Contents
require 'socket' require 'logstash-event' require_relative 'logstash_adapter/formatter' class Logasm module Adapters class LogstashAdapter attr_reader :logger def initialize(level, service, arguments = {}) host = arguments.fetch(:host) port = arguments.fetch(:port) device = UDPSocket.new.tap do |socket| socket.connect(host, port) end @logger = Logger.new(device).tap do |logger| logger.formatter = Formatter.new(service) logger.level = level end end def log(level, data) @logger.public_send level, data end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logasm-0.2.1 | lib/logasm/adapters/logstash_adapter.rb |
logasm-0.2.0 | lib/logasm/adapters/logstash_adapter.rb |