/**
* logQuery method
*
* Set timers, errors and refer to the parent
* If there are arguments passed - inject them into the query
* Show MongoIds in a copy-and-paste-into-mongo format
*
*
* @param mixed $query
* @param array $args array()
* @return void
* @access public
*/
public function logQuery($query, $args = array()) {
if ($args) {
$this->_stringify($args);
$query = String::insert($query, $args);
}
$this->took = round((microtime(true) - $this->_startTime) * 1000, 0);
$this->affected = null;
if (empty($this->error['err'])) {
$this->error = $this->_db->lastError();
if (!is_scalar($this->error)) {
$this->error = json_encode($this->error);
}
}
$this->numRows = !empty($args['count']) ? $args['count'] : null;
$query = preg_replace('@"ObjectId\((.*?)\)"@', 'ObjectId ("\1")', $query);
return parent::logQuery($query);
}