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
 
        - 
            
        
 
    
        - S
 
        - 
            
        
 
    
        - T
 
        - 
            
        
 
    
    
    
    
    
    
    
    
    
            Class Public methods
            
            
                
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
16:     def initialize(logger)
17:       @logger = logger
18:       @tags   = Hash.new { |h,k| h[k] = [] }
19:     end
                     
                 
                
             
            
            Instance Public methods
            
            
                
                    
                    add(severity, message = nil, progname = nil, &block)
                    
                
 
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
35:     def add(severity, message = nil, progname = nil, &block)
36:       message = (block_given? ? block.call : progname) if message.nil?
37:       @logger.add(severity, "#{tags_text}#{message}", progname)
38:     end
                     
                 
                
             
            
            
                
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
49:     def flush
50:       @tags.delete(Thread.current)
51:       @logger.flush if @logger.respond_to?(:flush)
52:     end
                     
                 
                
             
            
            
                
                    
                    method_missing(method, *args)
                    
                
 
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
54:     def method_missing(method, *args)
55:       @logger.send(method, *args)
56:     end
                     
                 
                
             
            
            
                
                    
                    silence(temporary_level = Logger::ERROR, &block)
                    
                
 
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
30:     def silence(temporary_level = Logger::ERROR, &block)
31:       @logger.silence(temporary_level, &block)
32:     end
                     
                 
                
             
            
            
                
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
21:     def tagged(*new_tags)
22:       tags     = current_tags
23:       new_tags = Array.wrap(new_tags).flatten.reject(&:blank?)
24:       tags.concat new_tags
25:       yield
26:     ensure
27:       new_tags.size.times { tags.pop }
28:     end
                     
                 
                
             
            
            Instance Protected methods
            
            
                
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
67:     def current_tags
68:       @tags[Thread.current]
69:     end
                     
                 
                
             
            
            
                
                
                
                
                
                
                    
                        Source: show
                        
                        | on GitHub
                        
                    
                    
                            
60:     def tags_text
61:       tags = current_tags
62:       if tags.any?
63:         tags.collect { |tag| "[#{tag}]" }.join(" ") + " "
64:       end
65:     end