Skip to content

Commit

Permalink
feat: add method initializeLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
mastudillot committed Jun 2, 2024
1 parent f7943f2 commit 459cda4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugin/shared/Helpers/PluginLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ public function __construct(LogConfig $config) {
$this->logger = new Logger('transbank');
$this->logger->pushHandler($stream);
}

private function initializeLogger(string $logFilePath)
{
$dateFormat = "Y-m-d H:i:s";
$output = "%datetime% > %level_name% > %message% %context% %extra%\n";
$formatter = new LineFormatter($output, $dateFormat);

$stream = new RotatingFileHandler($logFilePath,
100, Logger::DEBUG);
$stream->setFormatter($formatter);

$this->logger = new Logger('transbank');
$this->logger->pushHandler($stream);
}

private function getLogFilePath(): string
{
$logFileName = $this->getLogFileNameFromCache();
Expand Down

0 comments on commit 459cda4

Please sign in to comment.