Class: ElasticLogger::ElkWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic-logger/elk_writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, config:) ⇒ ElkWriter

Returns a new instance of ElkWriter.



5
6
7
8
# File 'lib/elastic-logger/elk_writer.rb', line 5

def initialize(name:, config:)
  @config = config
  @name = name
end

Instance Method Details

#log(severity, hash) ⇒ Object



10
11
12
# File 'lib/elastic-logger/elk_writer.rb', line 10

def log(severity, hash)
  client.index(index: index, type: name, body: build_log(severity, hash))
end