Skip to content

Commit 9ad06cf

Browse files
authored
Add NullLogger (#116)
1 parent 49b3516 commit 9ad06cf

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

src/Logger/NullLogger.php

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Webmozarts Console Parallelization package.
5+
*
6+
* (c) Webmozarts GmbH <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Webmozarts\Console\Parallelization\Logger;
15+
16+
use Throwable;
17+
18+
final class NullLogger implements Logger
19+
{
20+
public function logConfiguration(
21+
int $segmentSize,
22+
int $batchSize,
23+
int $numberOfItems,
24+
int $numberOfSegments,
25+
int $numberOfBatches,
26+
int $numberOfProcesses,
27+
string $itemName
28+
): void {
29+
// Do nothing.
30+
}
31+
32+
public function startProgress(int $numberOfItems): void
33+
{
34+
// Do nothing.
35+
}
36+
37+
public function advance(int $steps = 1): void
38+
{
39+
// Do nothing.
40+
}
41+
42+
public function finish(string $itemName): void
43+
{
44+
// Do nothing.
45+
}
46+
47+
public function logUnexpectedOutput(string $buffer, string $progressSymbol): void
48+
{
49+
// Do nothing.
50+
}
51+
52+
public function logCommandStarted(string $commandName): void
53+
{
54+
// Do nothing.
55+
}
56+
57+
public function logCommandFinished(): void
58+
{
59+
// Do nothing.
60+
}
61+
62+
public function logItemProcessingFailed(string $item, Throwable $throwable): void
63+
{
64+
// Do nothing.
65+
}
66+
}

src/Logger/ProgressBarFactory.php

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
interface ProgressBarFactory
2020
{
2121
/**
22+
* Creates a started progress bar.
23+
*
2224
* @param 0|positive-int $numberOfItems
2325
*/
2426
public function create(

0 commit comments

Comments
 (0)