Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Commit

Permalink
Logging profiler logs in start/end query functions.
Browse files Browse the repository at this point in the history
This fixes missing log output for QUERY_MODE_EXECUTE (#41) and additionally
means that the the "prepare" query is logged in the the same way as users
normally see on the zend debug toolbar.
  • Loading branch information
bnkr committed Nov 25, 2013
1 parent 1ad040a commit a26c75e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/BjyProfiler/Db/Profiler/LoggingProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,17 @@ public function __construct(Logger $logger, $enabled = true, array $options = ar
if (isset($options['parametersFinish'])) $this->setParametersFinish($options['parametersFinish']);
}

public function profilerStart($target)
{
parent::profilerStart($target);
public function startQuery($sql, $parameters = null, $stack = null) {
parent::startQuery($sql, $parameters, $stack);
$this->logStart();
}

public function endQuery() {
$this->logEnd();
parent::endQuery();
}

private function logStart() {
/** @var Query $lastQuery */
$lastQuery = end($this->profiles);
$this->getLogger()->log(
Expand All @@ -69,10 +76,7 @@ public function profilerStart($target)
);
}

public function profilerFinish()
{
parent::profilerFinish();

private function logEnd() {
/** @var Query $lastQuery */
$lastQuery = end($this->profiles);
$this->getLogger()->log(
Expand Down

0 comments on commit a26c75e

Please sign in to comment.