lib/loggerstash.rb in loggerstash-0.0.5 vs lib/loggerstash.rb in loggerstash-0.0.6

- old
+ new

@@ -37,15 +37,16 @@ # @param logstash_writer [LogstashWriter] in the event that you've already # got a LogstashWriter instance configured, you can pass it in here. Note # that any values you've set for logstash_server and metrics_registry # will be ignored. # - def initialize(logstash_server:, metrics_registry: nil, formatter: nil, logstash_writer: nil) - @logstash_server = logstash_server + def initialize(logstash_server:, metrics_registry: nil, formatter: nil, logstash_writer: nil, logger: nil) + @logstash_server = logstash_server @metrics_registry = metrics_registry - @formatter = formatter - @logstash_writer = logstash_writer + @formatter = formatter + @logstash_writer = logstash_writer + @logger = logger @op_mutex = Mutex.new end # Associate this Loggerstash with a Logger (or class of Loggers). @@ -120,9 +121,12 @@ if @logstash_writer.nil? {}.tap do |opts| opts[:server_name] = @logstash_server if @metrics_registry opts[:metrics_registry] = @metrics_registry + end + if @logger + opts[:logger] = @logger end @logstash_writer = LogstashWriter.new(**opts) @logstash_writer.run end