-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rotimi
committed
Dec 8, 2023
1 parent
7273509
commit 8cb3d99
Showing
2 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace SMVCTools\Tests\TestObjects; | ||
|
||
/** | ||
* Description of InMemoryLogger | ||
* | ||
* @author rotimi | ||
*/ | ||
class InMemoryLogger extends \Psr\Log\AbstractLogger { | ||
|
||
/** | ||
* @var string[] | ||
*/ | ||
protected array $log_entries = []; | ||
|
||
|
||
/** | ||
* Logs with an arbitrary level. | ||
* | ||
* @param mixed $level | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
* | ||
* @throws \Psr\Log\InvalidArgumentException | ||
*/ | ||
public function log($level, $message, array $context=[]) { | ||
|
||
$this->log_entries[] = "[LEVEL: {$level}] [MESSAGE: {$message}]"; | ||
} | ||
} |