Skip to content

Commit

Permalink
Support log rotation in LogIntoHttpArchive
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Nov 11, 2019
1 parent d5b9d3a commit ed404a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Interceptor/LogIntoHttpArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit ed404a7

Please sign in to comment.