Taking an example of a simple Ruby on Rails application. It creates a
Logger object during application load process:
# in environment.rb config.logger = Logger.new(<STDOUT | file | whatever>) # and in our application we use this object logger.warn "This process is taking too long to process. Optimization needed."
My question is, why don't we use class methods (or static methods) for logging? Won't
Logger.warn scale than
Logger.new.warn? Or atleast
Logger.warn seems intuitive than
Logger.new is a singleton object, what advantages does it offer?