From e974b741555c8a6ddaddec034a713da95f1cd920 Mon Sep 17 00:00:00 2001 From: Mike van den Hoek Date: Tue, 12 May 2026 12:04:57 +0200 Subject: [PATCH] feat: add action to capture logs in project --- src/LoggerZGW.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/LoggerZGW.php b/src/LoggerZGW.php index dd66761..e94bab1 100644 --- a/src/LoggerZGW.php +++ b/src/LoggerZGW.php @@ -40,7 +40,7 @@ public function __construct(Logger $logger ) /** * @since 1.0.0 */ - public function debug($message, array $context = array() ): void + public function debug(string $message, array $context = array() ): void { $this->add_record( Level::fromName( 'debug' )->value, $message, $context ); } @@ -48,7 +48,7 @@ public function debug($message, array $context = array() ): void /** * @since 1.0.0 */ - public function info($message, array $context = array() ): void + public function info(string $message, array $context = array() ): void { $this->add_record( Level::fromName( 'info' )->value, $message, $context ); } @@ -56,7 +56,7 @@ public function info($message, array $context = array() ): void /** * @since 1.0.0 */ - public function notice($message, array $context = array() ): void + public function notice(string $message, array $context = array() ): void { $this->add_record( Level::fromName( 'notice' )->value, $message, $context ); } @@ -64,7 +64,7 @@ public function notice($message, array $context = array() ): void /** * @since 1.0.0 */ - public function warning($message, array $context = array() ): void + public function warning(string $message, array $context = array() ): void { $this->add_record( Level::fromName( 'warning' )->value, $message, $context ); } @@ -72,7 +72,7 @@ public function warning($message, array $context = array() ): void /** * @since 1.0.0 */ - public function error($message, array $context = array() ): void + public function error(string $message, array $context = array() ): void { $this->add_record( Level::fromName( 'error' )->value, $message, $context ); } @@ -82,6 +82,8 @@ public function error($message, array $context = array() ): void */ protected function add_record(int $level, string $message, array $context = array() ): void { + do_action('owcgfzgw::log-message/intercept', $message, $context); + if ( ! ( (bool) ContainerResolver::make()->get( 'message.logger.active' ) ) ) { return; }