Skip to content

Commit

Permalink
Update internal logging operations to be compliant with PSR-3.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksucherek committed Jan 22, 2025
1 parent 2a03ede commit e293703
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Ouzo/Core/Db/StatementExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function createPdoStatement(array $options = []): PDOStatement
$sqlString = $this->prepareSqlString();

$callingClass = Backtrace::getCallingClass();
Logger::getLogger(__CLASS__)->info("From: {$callingClass} Query: {$sqlString}");
Logger::getLogger(__CLASS__)->asLoggerInterface()->info("From: {$callingClass} Query: {$sqlString}");

return $this->pdoExecutor->createPDOStatement($this->dbHandle, $this->sql, $this->boundValues, $sqlString, $options);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ouzo/Core/Db/StatementIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function rewind(): void

public function closeCursor(): void
{
Logger::getLogger(__CLASS__)->info("Closing cursor");
Logger::getLogger(__CLASS__)->asLoggerInterface()->info("Closing cursor");
$this->statement->closeCursor();
}
}
2 changes: 1 addition & 1 deletion src/Ouzo/Core/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function init(): void
$env = getenv('environment');
if ($env === false) {
$errorMessage = 'Can\'t determine configuration environment.';
Logger::getLogger(__CLASS__)->error($errorMessage);
Logger::getLogger(__CLASS__)->asLoggerInterface()->error($errorMessage);
throw new RuntimeException($errorMessage);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ouzo/Core/ExceptionHandling/ExceptionLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function forException(Exception $exception, $httpCode = 500): Exce
public function log(): void
{
$message = $this->getMessage();
Logger::getLogger(__CLASS__)->error($message);
Logger::getLogger(__CLASS__)->asLoggerInterface()->error($message);
}

public function getMessage(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Ouzo/Core/Middleware/Interceptor/LogRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function handle(mixed $param, Chain $next): mixed

private function handleRequestContext(RequestContext $requestContext, Chain $next): mixed
{
Logger::getLogger(__CLASS__)->info(sprintf('[Action: %s#%s] [Request: %s %s]',
Logger::getLogger(__CLASS__)->asLoggerInterface()->info(sprintf('[Action: %s#%s] [Request: %s %s]',
$requestContext->getCurrentController(),
$requestContext->getCurrentAction(),
Uri::getRequestType(),
Expand Down

0 comments on commit e293703

Please sign in to comment.