From ed404a7a980b4a464e86f46ee02abc92b496b163 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Mon, 11 Nov 2019 22:00:18 +0100 Subject: [PATCH] Support log rotation in LogIntoHttpArchive --- src/Interceptor/LogIntoHttpArchive.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Interceptor/LogIntoHttpArchive.php b/src/Interceptor/LogIntoHttpArchive.php index 80d48f2f..3a4d9528 100644 --- a/src/Interceptor/LogIntoHttpArchive.php +++ b/src/Interceptor/LogIntoHttpArchive.php @@ -151,12 +151,18 @@ public function request(Request $request, CancellationToken $cancellation, Deleg public function reset(): Promise { - return call(function () { + return $this->rotate($this->filePath); + } + + public function rotate(string $filePath): Promise + { + return call(function () use ($filePath) { /** @var Lock $lock */ $lock = yield $this->fileMutex->acquire(); // Will automatically reopen and reset the file $this->fileHandle = null; + $this->filePath = $filePath; $this->error = null; $lock->release();