module LogStashLogger::TaggedLogging::Formatter

Public Instance Methods

clear_tags!() click to toggle source
# File lib/logstash-logger/tagged_logging.rb, line 31
def clear_tags!
  current_tags.clear
end
current_tags() click to toggle source
# File lib/logstash-logger/tagged_logging.rb, line 35
def current_tags
  Thread.current[:logstash_logger_tags] ||= []
end
pop_tags(size = 1) click to toggle source
# File lib/logstash-logger/tagged_logging.rb, line 27
def pop_tags(size = 1)
  current_tags.pop size
end
push_tags(*tags) click to toggle source
# File lib/logstash-logger/tagged_logging.rb, line 21
def push_tags(*tags)
  tags.flatten.reject{ |t| t.nil? || t.empty? }.tap do |new_tags|
    current_tags.concat new_tags
  end
end
tagged(*tags) { |self| ... } click to toggle source
# File lib/logstash-logger/tagged_logging.rb, line 14
def tagged(*tags)
  new_tags = push_tags(*tags)
  yield self
ensure
  pop_tags(new_tags.size)
end