Wraps any standard Logger class to provide tagging capabilities. Examples:
Logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) Logger.tagged("BCX") { Logger.info "Stuff" } # Logs "[BCX] Stuff" Logger.tagged("BCX", "Jason") { Logger.info "Stuff" } # Logs "[BCX] [Jason] Stuff" Logger.tagged("BCX") { Logger.tagged("Jason") { Logger.info "Stuff" } } # Logs "[BCX] [Jason] Stuff"
This is used by the default Rails.logger as configured by Railties to make it easy to stamp log lines with subdomains, request ids, and anything else to aid debugging of multi-user production applications.
Methods
- A
- C
- F
- M
- N
- P
- R
- S
- T
Class Public methods
new(logger)
Link
Instance Public methods
add(severity, message = nil, progname = nil, &block)
Link
# File activesupport/lib/active_support/tagged_logging.rb, line 46 def add(severity, message = nil, progname = nil, &block) if message.nil? if block_given? message = block.call else message = progname progname = nil #No instance variable for this like Logger end end @logger.add(severity, "#{tags_text}#{message}", progname) end
flush()
Link
method_missing(method, *args)
Link
respond_to?(*args)
Link
respond_to_missing?(*args)
Link
silence(temporary_level = Logger::ERROR, &block)
Link