Skip to content

Commit

Permalink
Add console config for logger flushing (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
rustamwin committed May 18, 2021
1 parent 32d03cb commit e1e7754
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -3,7 +3,7 @@

## 1.0.2 under development

- no changes in this release.
- Bug #67: Flush logger on the console is terminated (rustamwin)


## 1.0.1 March 23, 2021
Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -53,6 +53,7 @@
"source-directory": "config"
},
"config-plugin": {
"events-console": "events-console.php",
"events-web": "events-web.php"
}
},
Expand Down
17 changes: 17 additions & 0 deletions config/events-console.php
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Yiisoft\Log\Logger;

return [
ConsoleTerminateEvent::class => [
static function (LoggerInterface $logger): void {
if ($logger instanceof Logger) {
$logger->flush(true);
}
},
],
];

0 comments on commit e1e7754

Please sign in to comment.