From 459cda48ee0b1aab47d993ee2d19d66199bbf1b9 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Sun, 2 Jun 2024 18:25:57 -0400 Subject: [PATCH] feat: add method initializeLogger --- plugin/shared/Helpers/PluginLogger.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugin/shared/Helpers/PluginLogger.php b/plugin/shared/Helpers/PluginLogger.php index f0f3815..a90108f 100644 --- a/plugin/shared/Helpers/PluginLogger.php +++ b/plugin/shared/Helpers/PluginLogger.php @@ -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();