self::buildFileLogger($logConfig, $projectDir, $channel), 'systemd' => new SystemdLogger($channel), 'syslog' => new SyslogLogger( $logConfig['ident'] ?? 'ktrix', $logConfig['facility'] ?? LOG_USER, $channel, ), 'null' => new NullLogger(), default => throw new \RuntimeException( sprintf( 'Unknown log driver "%s". Supported drivers: file, systemd, syslog, null.', $driver ) ), }; return new LevelFilterLogger($inner, $level); } private static function buildFileLogger(array $logConfig, string $projectDir, string $channel): FileLogger { $path = $logConfig['path'] ?? null; if ($path === null || $path === '') { $path = $projectDir . '/var/log'; } return new FileLogger($path, $channel); } }