Created
February 8, 2011 00:37
-
-
Save visnup/815607 to your computer and use it in GitHub Desktop.
# trippy mongodb colorized logging by statement type
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
class Mongoid::Logger | |
def debug message | |
op = | |
case message | |
when /insert/ then "\e[0;32m(C)\e[0m" | |
when /find|cursor/ then "\e[0;34m(R)\e[0m" | |
when /update/ then "\e[0;33m(U)\e[0m" | |
when /remove/ then "\e[0;31m(D)\e[0m" | |
end | |
logger.debug("#{op} #{message}") if logger && logger.respond_to?(:debug) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ooh, mongo ruby driver 1.2.1 just got released. I'll see if I can update it.