From 6ad2f0f46b4ddd98500b5fa63c9b88078f4ffc3e Mon Sep 17 00:00:00 2001 From: Oleksandr Diudiun Date: Mon, 20 Jun 2022 12:53:52 +0200 Subject: [PATCH] test --- src/Log.php | 55 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/Log.php b/src/Log.php index 577bfd3..22f009b 100644 --- a/src/Log.php +++ b/src/Log.php @@ -1,55 +1,62 @@ -"; self::$instance->error($error); } - + public static function contextProcessor($record) { $record['extra'] = self::$context; return $record; } - public static function registerShutdownFunction(array $additionalShutdownFunctions = []):void { - foreach($additionalShutdownFunctions as $function) { + public static function registerShutdownFunction(array $additionalShutdownFunctions = []): void + { + foreach ($additionalShutdownFunctions as $function) { register_shutdown_function($function); } register_shutdown_function("\Memcrab\Log\Log::shutdown"); - - if(function_exists('pcntl_signal')) { - pcntl_signal(SIGTERM, "\Memcrab\Log\Log::shutdown"); - pcntl_signal(SIGUSR1, "\Memcrab\Log\Log::shutdown"); - } else { - error_log("pcntl_signal not available please install pcntl php Module"); - } + + # this part need to be implement with Monolog Signals Registration as a tool in monolog reop [14.06.22] + // if(function_exists('pcntl_signal')) { + // pcntl_signal(SIGTERM, "\Memcrab\Log\Log::shutdown"); + // pcntl_signal(SIGUSR1, "\Memcrab\Log\Log::shutdown"); + // } else { + // error_log("pcntl_signal not available please install pcntl php Module"); + // } } public static function setServiceContext( - string $project, - string $service, - string $environment, - bool $DEBUG_MODE, - string $hostname, - string $ip, - string $os - ):void { + string $project, + string $service, + string $environment, + bool $DEBUG_MODE, + string $hostname, + string $ip, + string $os + ): void { self::$context = [ 'project' => $project, 'service' => $service,