module Logged::TaggedLogging

Tagged logging support

Public Instance Methods

current_tags() click to toggle source
# File lib/logged/tagged_logging.rb, line 28
def current_tags
  Thread.current["logged_logger_tags_#{component}"] ||= []
end
flush() click to toggle source
# File lib/logged/tagged_logging.rb, line 14
def flush
  current_tags.clear
end
pop_tags(size = 1) click to toggle source
# File lib/logged/tagged_logging.rb, line 24
def pop_tags(size = 1)
  current_tags.pop(size)
end
push_tags(*tags) click to toggle source
# File lib/logged/tagged_logging.rb, line 18
def push_tags(*tags)
  tags.flatten.reject(&:blank?).tap do |new_tags|
    current_tags.concat(new_tags)
  end
end
tagged(*tags) { |self| ... } click to toggle source
# File lib/logged/tagged_logging.rb, line 6
def tagged(*tags)
  new_tags = push_tags(*tags)

  yield self
ensure
  pop_tags(new_tags.size)
end