Skip to content

Commit

Permalink
DbLoggerInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdef committed Jan 2, 2024
1 parent b7bcc2b commit 8f985b5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
namespace Yiisoft\Db\Mysql;

use Exception;
use Psr\Log\LogLevel;
use Yiisoft\Db\Driver\Pdo\AbstractPdoConnection;
use Yiisoft\Db\Driver\Pdo\PdoCommandInterface;
use Yiisoft\Db\Logger\Context\ConnectionContext;
use Yiisoft\Db\Logger\DbLoggerEvent;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Db\Schema\QuoterInterface;
use Yiisoft\Db\Schema\SchemaInterface;
Expand All @@ -23,10 +24,7 @@ final class Connection extends AbstractPdoConnection
public function close(): void
{
if ($this->pdo !== null) {
$this->logger?->log(
LogLevel::DEBUG,
'Closing DB connection: ' . $this->driver->getDsn() . ' ' . __METHOD__,
);
$this->logger?->log(DbLoggerEvent::CONNECTION_END, new ConnectionContext(__METHOD__, $this->getDriver()->getDsn()));

// Solution for close connections {@link https://stackoverflow.com/questions/18277233/pdo-closing-connection}
try {
Expand Down

0 comments on commit 8f985b5

Please sign in to comment.