Ji-Yuhang
5/24/2016 - 7:21 AM

custom rails log by open class: ActiveSupport::Logger::SimpleFormatter

custom rails log by open class: ActiveSupport::Logger::SimpleFormatter

# You can enable this feature by: LOGGER=crazy rails s

# File : config/initializers/logger.rb
if ENV["LOGGER"] == "crazy"
  class ActiveSupport::Logger::SimpleFormatter
    def call(severity, time, progname, msg)
      "#{severity} #{time}: #{progname} #{caller.grep(/phoenix/)} -- : #{msg}\n"
    end
  end
end