Created
September 14, 2024 16:28
-
-
Save remy727/bb84e24978c4035c72af1ebd4919a38a to your computer and use it in GitHub Desktop.
Rails Colored Console Logging Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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