Skip to content

Commit

Permalink
implemented tests for custom log level
Browse files Browse the repository at this point in the history
  • Loading branch information
henning committed Jun 7, 2022
1 parent e45720a commit ea8c2e4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/DefaultLogWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,35 @@ public function it_logs_multiple_files_in_an_array()
$this->assertStringContainsString('first.doc', $log);
$this->assertStringContainsString('second.doc', $log);
}

/** @test */
public function it_logs_using_the_default_log_level()
{
$request = $this->makeRequest('post', $this->uri, [
'name' => 'Name',
]);

$this->logger->logRequest($request);

$log = $this->readLogFile();

$this->assertStringContainsString('testing.INFO', $log);
$this->assertStringContainsString('"name":"Name', $log);
}

/** @test */
public function it_logs_using_the_configured_log_level()
{
config(['http-logger.log_level' => 'debug']);
$request = $this->makeRequest('post', $this->uri, [
'name' => 'Name',
]);

$this->logger->logRequest($request);

$log = $this->readLogFile();

$this->assertStringContainsString('testing.DEBUG', $log);
$this->assertStringContainsString('"name":"Name', $log);
}
}

0 comments on commit ea8c2e4

Please sign in to comment.