File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -549,22 +549,14 @@ You can chain these methods for convenience.
549549## Logging
550550
551551For logging purposes, you need use class, which implements ` \Psr\Log\LoggerInterface ` .
552- Example of using:
552+ YDB-PHP-SDK has build-in loggers in ` YdbPlatform\Ydb\Logger ` namespace:
553+ * ` NullLogger ` - default
554+ * ` SimpleStdLogger($level) ` - logger, which push logs in STDERR.
553555
556+ Example of using:
554557``` php
555- class SimpleLogger extends \Psr\Log\LoggerInterface
556- {
557- use LoggerTrait;
558- public function log($level, string $message, array $context = []): void
559- {
560- fwrite(STDERR,
561- date("d/m/y H:i:s")." ".self::getLevelName($level). " ".$message." ".json_encode($context)."\n"
562- );
563- }
564- }
565-
566558$config = [
567- 'logger' => new SimpleLogger( )
559+ 'logger' => new \YdbPlatform\Ydb\Logger\SimpleStdLogger(\YdbPlatform\Ydb\Logger\SimpleStdLogger::INFO )
568560]
569561$ydb = new \YdbPlatform\Ydb\Ydb($config);
570562```
You can’t perform that action at this time.
0 commit comments