Skip to content

Instantly share code, notes, and snippets.

@visnup
Created February 8, 2011 00:37
Show Gist options
  • Save visnup/815607 to your computer and use it in GitHub Desktop.
Save visnup/815607 to your computer and use it in GitHub Desktop.
# trippy mongodb colorized logging by statement type
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
@visnup
Copy link
Author

visnup commented Feb 11, 2011

ooh, mongo ruby driver 1.2.1 just got released. I'll see if I can update it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment