13
13
class MftfLogger extends Logger
14
14
{
15
15
/**
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 .
17
17
*
18
18
* @param string $message The log message.
19
19
* @param array $context The log context.
@@ -23,12 +23,14 @@ class MftfLogger extends Logger
23
23
*/
24
24
public function deprecation ($ message , array $ context = [], $ verbose = false )
25
25
{
26
- $ message = "DEPRECATION: " . $ message ;
27
26
// 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 );
30
33
}
31
- parent ::warning ($ message , $ context );
32
34
}
33
35
34
36
/**
@@ -51,7 +53,7 @@ public function criticalFailure($message, array $context = [], $verbose = false)
51
53
}
52
54
53
55
/**
54
- * Adds a log record at the NOTICE level.
56
+ * Adds a log record at the NOTICE level during test generation .
55
57
*
56
58
* @param string $message
57
59
* @param array $context
@@ -61,11 +63,13 @@ public function criticalFailure($message, array $context = [], $verbose = false)
61
63
*/
62
64
public function notification ($ message , array $ context = [], $ verbose = false )
63
65
{
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 );
68
73
}
69
- parent ::notice ($ message , $ context );
70
74
}
71
75
}
0 commit comments