| @@ 276-289 (lines=14) @@ | ||
| 273 | * @throws \RuntimeException |
|
| 274 | * @throws \InvalidArgumentException |
|
| 275 | */ |
|
| 276 | private function getLogFilename(): string |
|
| 277 | { |
|
| 278 | $logDir = $this->getLogDirectory(); |
|
| 279 | if (! @mkdir($logDir, 0777, true) && ! is_dir($logDir)) { |
|
| 280 | throw new \RuntimeException('Cannot create folder for JSON logs'); |
|
| 281 | } |
|
| 282 | ||
| 283 | $logFilename = getenv(EnvVariables::PROCESS_UNIQUE_ID); |
|
| 284 | if ($logFilename === false) { |
|
| 285 | throw new \InvalidArgumentException('Log filename not received: environment variable not set'); |
|
| 286 | } |
|
| 287 | ||
| 288 | return $logDir . $logFilename . '.json.log'; |
|
| 289 | } |
|
| 290 | ||
| 291 | /** |
|
| 292 | * @return string |
|
| @@ 287-300 (lines=14) @@ | ||
| 284 | * @throws \RuntimeException |
|
| 285 | * @throws \InvalidArgumentException |
|
| 286 | */ |
|
| 287 | private function getLogFilename(): string |
|
| 288 | { |
|
| 289 | $logDir = $this->getLogDirectory(); |
|
| 290 | if (! @mkdir($logDir, 0777, true) && ! is_dir($logDir)) { |
|
| 291 | throw new \RuntimeException('Cannot create folder for JSON logs'); |
|
| 292 | } |
|
| 293 | ||
| 294 | $logFilename = getenv(EnvVariables::PROCESS_UNIQUE_ID); |
|
| 295 | if ($logFilename === false) { |
|
| 296 | throw new \InvalidArgumentException('Log filename not received: environment variable not set'); |
|
| 297 | } |
|
| 298 | ||
| 299 | return $logDir . $logFilename . '.json.log'; |
|
| 300 | } |
|
| 301 | ||
| 302 | /** |
|
| 303 | * @return string |
|