I would like to define a custom logger for my Rails 3 app, in a way that it does not replace the original logger (I still make use of its information).
I assumed that I could define in a lib a class that inherited BufferedLogger as I've seen on some blogs. Then I would instantiate a variable to represent my logger, on the end of my application.rb with those lines:
require 'smart_logger.rb'
sl = SmartLogger.new("log/soccer.log")
And in my controller (as models and views) I would be able to use:
sl.warn("Tentativa #{session[:login_number]} de fazer login do IP#{request.remote_ip}, email:#{@user_session.try :email}, senha: #{@user_session.try :password}. ")
My question is how can I achieve to have my custom logger available application wide and flushing properly? That would be sort of a parallel logger.