2012-05-30 8 views

risposta

7

BufferedLogger è il logger Rails predefinito. Il suo scopo è quello di rendere il logging sicuro. Opzionalmente, è possibile racchiudere questo registratore in un TaggedBufferedLogger e utilizzarlo, se si desidera "taggare" l'output di registrazione.

Direttamente dalle weblog.rails

Tagged logger 

When you’re running a multi-user, multi-account application, it’s a great help to be able to filter the log by who did what. Enter the TaggedLogging wrapper. It works like this: 

Logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) 
Logger.tagged("BCX") { Logger.info "Stuff" } # Logs "[BCX] Stuff" 
Logger.tagged("BCX") do 
    Logger.tagged("Jason") do 
    Logger.info "Stuff" # Logs "\[BCX\] \[Jason\] Stuff" 
    end 
end 
Problemi correlati