Skip to content

Instantly share code, notes, and snippets.

@remy727
Created September 14, 2024 16:28
Show Gist options
  • Save remy727/bb84e24978c4035c72af1ebd4919a38a to your computer and use it in GitHub Desktop.
Save remy727/bb84e24978c4035c72af1ebd4919a38a to your computer and use it in GitHub Desktop.
Rails Colored Console Logging Examples
# Red
Rails.logger.info "\e[31m[Error] Something went wrong\e[0m"
# Green
Rails.logger.info "\e[32m[Success] Operation completed\e[0m"
# Yellow
Rails.logger.info "\e[33m[Warning] Approaching limit\e[0m"
# Blue
Rails.logger.info "\e[34m[Info] Processing data\e[0m"
# Magenta
Rails.logger.info "\e[35m[Debug] Variable state\e[0m"
# Cyan
Rails.logger.info "\e[36m[Notice] System update\e[0m"
# White
Rails.logger.info "\e[37m[Default] Regular log message\e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment