Nice colorized logs for Rails apps with this initializer, you can instantly colorize your Rails development logs.
      
      Used 16 times
        
          d
          dpaluy
        
      Usage
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/z0gs1M"Template Source
Review the code before running this template on your machine.
content = <<~EOS
# frozen_string_literal: true
module ColorizedLogger
  %i[debug info warn error fatal unknown].each do |level|
    color = case level
            when :debug then "\e[0;36m"  # Cyan text
            when :info  then "\e[0;32m"  # Green text
            when :warn  then "\e[1;33m"  # Yellow text
            when :error, :fatal then "\e[1;31m"  # Red text
            else "\e[0m"  # Terminal default
            end
    
    define_method(level) do |progname = nil, &block| 
      super(color + (progname || (block && block.call)).to_s + "\e[0m")
    end
  end
end
Rails.logger.extend(ColorizedLogger)
EOS
initializer "colorized_logger.rb", content