fix: use Docker PHP-FPM to support sampling in conformance tests (#219)
This commit is contained in:
parent
96ab01712b
commit
4c3e5e61c7
1 changed files with 144 additions and 40 deletions
33
tests/Conformance/FileLogger.php
Normal file
33
tests/Conformance/FileLogger.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the official PHP MCP SDK.
|
||||
*
|
||||
* A collaboration between Symfony and the PHP Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mcp\Tests\Conformance;
|
||||
|
||||
use Psr\Log\AbstractLogger;
|
||||
|
||||
final class FileLogger extends AbstractLogger
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $filePath,
|
||||
private readonly bool $debug = false,
|
||||
) {
|
||||
}
|
||||
|
||||
public function log($level, mixed $message, array $context = []): void
|
||||
{
|
||||
if (!$this->debug && 'debug' === $level) {
|
||||
return;
|
||||
}
|
||||
|
||||
$logMessage = \sprintf("[%s] %s\n", strtoupper($level), $message);
|
||||
file_put_contents($this->filePath, $logMessage, \FILE_APPEND);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue