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.
549
549
## Logging
550
550
551
551
For 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.
553
555
556
+ Example of using:
554
557
``` 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
-
566
558
$config = [
567
- 'logger' => new SimpleLogger( )
559
+ 'logger' => new \YdbPlatform\Ydb\Logger\SimpleStdLogger(\YdbPlatform\Ydb\Logger\SimpleStdLogger::INFO )
568
560
]
569
561
$ydb = new \YdbPlatform\Ydb\Ydb($config);
570
562
```
You can’t perform that action at this time.
0 commit comments