$context */ public static function info(string $message, ?PlatformChannel $channel = null, array $context = []): void { self::log(LogLevelEnum::INFO, $message, $channel, $context); } /** * @param array $context */ public static function error(string $message, ?PlatformChannel $channel = null, array $context = []): void { self::log(LogLevelEnum::ERROR, $message, $channel, $context); } /** * @param array $context */ public static function warning(string $message, ?PlatformChannel $channel = null, array $context = []): void { self::log(LogLevelEnum::WARNING, $message, $channel, $context); } /** * @param array $context */ public static function debug(string $message, ?PlatformChannel $channel = null, array $context = []): void { self::log(LogLevelEnum::DEBUG, $message, $channel, $context); } /** * @param array $context */ private static function log(LogLevelEnum $level, string $message, ?PlatformChannel $channel = null, array $context = []): void { $logContext = $context; if ($channel) { $logContext = array_merge($logContext, [ 'channel_id' => $channel->id, 'channel_name' => $channel->name, 'platform' => $channel->platformInstance->platform->value, 'instance_url' => $channel->platformInstance->url, ]); } Log::create([ 'level' => $level, 'message' => $message, 'context' => $logContext, ]); } }