Skip to content

Commit cddf0b7

Browse files
committed
Create dir only if it does not exit, not if the file does not exist
1 parent 21205ad commit cddf0b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Logger/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(string $filePath)
2121

2222
public function log($level, $message, array $context = []): void
2323
{
24-
if (!file_exists($this->filePath)) {
24+
if (!file_exists(dirname($this->filePath))) {
2525
if (!mkdir($concurrentDirectory = dirname($this->filePath), 0777, true) && !is_dir($concurrentDirectory)) {
2626
throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
2727
}

0 commit comments

Comments
 (0)