Skip to content

Commit f57b87c

Browse files
committed
MQE-2143: Cleanup mftf.log
Changed deprecation and notices to log only during test generation
1 parent 545a266 commit f57b87c

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/Magento/FunctionalTestingFramework/Util/Logger/MftfLogger.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class MftfLogger extends Logger
1414
{
1515
/**
16-
* Prints a deprecation warning, as well as adds a log at the WARNING level.
16+
* Prints a deprecation warning, as well as adds a log at the WARNING level during test generation.
1717
*
1818
* @param string $message The log message.
1919
* @param array $context The log context.
@@ -23,12 +23,14 @@ class MftfLogger extends Logger
2323
*/
2424
public function deprecation($message, array $context = [], $verbose = false)
2525
{
26-
$message = "DEPRECATION: " . $message;
2726
// Suppress print during unit testing
28-
if (MftfApplicationConfig::getConfig()->getPhase() !== MftfApplicationConfig::UNIT_TEST_PHASE && $verbose) {
29-
print ($message . json_encode($context) . "\n");
27+
if (MftfApplicationConfig::getConfig()->getPhase() === MftfApplicationConfig::GENERATION_PHASE) {
28+
$message = "DEPRECATION: " . $message;
29+
if ($verbose) {
30+
print ($message . json_encode($context) . "\n");
31+
}
32+
parent::warning($message, $context);
3033
}
31-
parent::warning($message, $context);
3234
}
3335

3436
/**
@@ -51,7 +53,7 @@ public function criticalFailure($message, array $context = [], $verbose = false)
5153
}
5254

5355
/**
54-
* Adds a log record at the NOTICE level.
56+
* Adds a log record at the NOTICE level during test generation.
5557
*
5658
* @param string $message
5759
* @param array $context
@@ -61,11 +63,13 @@ public function criticalFailure($message, array $context = [], $verbose = false)
6163
*/
6264
public function notification($message, array $context = [], $verbose = false)
6365
{
64-
$message = "NOTICE: " . $message;
65-
// Suppress print during unit testing
66-
if (MftfApplicationConfig::getConfig()->getPhase() !== MftfApplicationConfig::UNIT_TEST_PHASE && $verbose) {
67-
print ($message . implode("\n", $context) . "\n");
66+
// Print during generation phase
67+
if (MftfApplicationConfig::getConfig()->getPhase() === MftfApplicationConfig::GENERATION_PHASE) {
68+
$message = "NOTICE: " . $message;
69+
if ($verbose) {
70+
print ($message . implode("\n", $context) . "\n");
71+
}
72+
parent::notice($message, $context);
6873
}
69-
parent::notice($message, $context);
7074
}
7175
}

0 commit comments

Comments
 (0)