mongoid/moped — pull request #318 by y8 (2014-09-20 23:15:31+00:00)
Title: Finally, fix logging format

Sorry, I'm kinda late for 2.0 release, but still.

Before this pull request, when you copy & paste stuff from logs it was like:

````
mongo> {"$query"=>{:likes=>{"$exists"=>false}}, "$explain"=>true, "$orderby"=>{:_id=>1}, "$maxScan"=>10} flags=[] limit=0 skip=0 batch_size=nil fields=nil
SyntaxError: Unexpected token >

(ﾉಥ益ಥ）ﾉ﻿ ┻━┻
````

After this pull request and after `Moped.log_format = Moped::LogFormat::ShellFormat` it is like:
```
mongo> db.users.find({"likes":{"$exists":false}})._addSpecial({"$maxScan":1}).explain(true)
{
"cursor" : "BasicCursor",
"isMultiKey" : false,
"n" : 1109994,
"nscannedObjects" : 1109994,
"nscanned" : 1109994,
"nscannedObjectsAllPlans" : 1109994,
"nscannedAllPlans" : 1109994,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 8671,
"nChunkSkips" : 0,
"millis" : 5979,
"allPlans" : [
{
"cursor" : "BasicCursor",
"isMultiKey" : false,
"n" : 1109994,
"nscannedObjects" : 1109994,
"nscanned" : 1109994,
"scanAndOrder" : false,
"indexOnly" : false,
"nChunkSkips" : 0
}
],
"server" : "yopp-air:27017",
"filterSet" : false,
"stats" : {
"type" : "COLLSCAN",
"works" : 1109996,
"yields" : 8671,
"unyields" : 8671,
"invalidates" : 0,
"advanced" : 1109994,
"needTime" : 1,
"needFetch" : 0,
"isEOF" : 1,
"docsTested" : 1109994,
"children" : [ ]
}
}
ヽ(^。^)ノ
````

Give it a try `rake MOPED_LOG_FORMAT=Moped::LogFormat::ShellFormat MOPED_PRINT_LOG=1`

Few notes:
1. It's backward compatible, so nothing is broken until you ask to break it for you!
2. Now in technicolor!
3. Be creative, make your own log formatter without dirty patching!
4. ShellFormat is not fully tested. It might produce something incompatible in some cases. Feedback is very welcome.