Skip to content

Commit 6a64817

Browse files
committed
introduce PHPUnit series in log filename
1 parent e8df560 commit 6a64817

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/bootstrap.monolog.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
require_once dirname(__DIR__) . '/vendor' . '/autoload.php';
44

@@ -8,6 +8,8 @@
88
use Bartlett\Monolog\Handler\GrowlHandler;
99
use Bartlett\Monolog\Handler\CallbackFilterHandler;
1010

11+
use PHPUnit\Runner\Version;
12+
1113
class YourMonolog extends Logger
1214
{
1315
public function __construct($name = 'PHPUnit', $level = 'debug')
@@ -27,7 +29,7 @@ function($record, $handlerLevel) {
2729
);
2830

2931
$stream = new RotatingFileHandler(
30-
__DIR__ . DIRECTORY_SEPARATOR . 'monologTestListener.log',
32+
__DIR__ . DIRECTORY_SEPARATOR . 'monologTestListener-phpunit-' . Version::series() . '.log',
3133
0, // maximal amount of files to keep (0 means unlimited)
3234
Logger::toMonologLevel($level)
3335
);
@@ -42,7 +44,7 @@ function($record, $handlerLevel) {
4244

4345
$handlers[] = new CallbackFilterHandler($growl, $filters);
4446

45-
} catch (\Exception $e) {
47+
} catch (Exception $e) {
4648
// Growl server is probably not started
4749
echo $e->getMessage(), PHP_EOL, PHP_EOL;
4850
}

0 commit comments

Comments
 (0)