module ActiveSupport::TaggedLogging::Formatter

def call(severity, timestamp, progname, msg)

This method is invoked when a log event occurs.
:nodoc:
def call(severity, timestamp, progname, msg)
  super(severity, timestamp, progname, "#{tags_text}#{msg}")
end

def clear_tags!

def clear_tags!
  current_tags.clear
end

def current_tags

def current_tags
  Thread.current[:activesupport_tagged_logging_tags] ||= []
end

def pop_tags(size = 1)

def pop_tags(size = 1)
  current_tags.pop size
end

def push_tags(*tags)

def push_tags(*tags)
  tags.flatten.reject(&:blank?).tap do |new_tags|
    current_tags.concat new_tags
  end
end

def tagged(*tags)

def tagged(*tags)
  new_tags = push_tags(*tags)
  yield self
ensure
  pop_tags(new_tags.size)
end

def tags_text

def tags_text
  tags = current_tags
  if tags.any?
    tags.collect { |tag| "[#{tag}] " }.join
  end
end