Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param integer $level the debug level
  */
 public function __construct($level, ORM\EntityManager $em)
 {
     // taking timestamp to stop execution time
     $this->created = microtime(TRUE);
     // saving debug level
     $this->level = $level;
     // starting logging of sql queries
     $this->sqlLogger = new Logging\DebugStack();
     $em->getConnection()->getConfiguration()->setSQLLogger($this->sqlLogger);
     if (isset(self::$instance)) {
         throw new \Exception('Debugging has already been started. Please use the static functions!');
     }
     self::$instance = $this;
 }
Exemplo n.º 2
0
 /**
  * Deactivate debugging (for http server)
  * @return boolean
  */
 public static function deactivate()
 {
     if (self::$instance) {
         self::$instance->attachSqlLogger(null);
         self::$instance = null;
     }
 }