示例#1
0
 public function logQuery($sql)
 {
     if (isset(static::$configs['DEBUG']) && isset(static::$configs['DEBUG_LEVEL'])) {
         $logString = 'Begin:' . date('Y-m-d H:i:s', $this->queryBeginTime) . "\n";
         $logString .= 'SQL: ' . $sql . "\n";
         switch (static::$configs['DEBUG_LEVEL']) {
             case 2:
                 //looks ugly
                 $tempE = new \Exception();
                 $logString .= "Trace:\n" . $tempE->getTraceAsString() . "\n";
                 continue;
             case 1:
             default:
                 continue;
         }
         $logString .= 'End:' . date('Y-m-d H:i:s', $this->queryEndTime) . '  Total:' . sprintf('%.3f', ($this->queryEndTime - $this->queryBeginTime) * 1000) . 'ms' . "\n";
         \Log\Handler::instance('db')->log($logString);
     }
 }
示例#2
0
 public function testLog()
 {
     return \Log\Handler::instance('inventoryLog')->log(array('CartTest', 'sku889911', '1363417830', 'TestService', array('id' => 1, 'user' => 'dev'), array('time' => 1363417830, 'ok' => 'yes'), 1, 33));
 }