| 1 |
<?php |
| 2 |
|
| 3 |
namespace LIBRARY; |
| 4 |
|
| 5 |
class Logger extends \AwesomeMotive\WPContentImporter2\WPImporterLoggerCLI { |
| 6 |
|
| 7 |
public $error_output = ''; |
| 8 |
|
| 9 |
public function log( $level, $message, array $context = array() ) { |
| 10 |
|
| 11 |
$this->error_output( $level, $message, $context = array() ); |
| 12 |
|
| 13 |
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( $this->min_level ) ) { |
| 14 |
return; |
| 15 |
} |
| 16 |
|
| 17 |
printf( |
| 18 |
'[%s] %s' . PHP_EOL, |
| 19 |
strtoupper( $level ), |
| 20 |
$message |
| 21 |
); |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
public function error_output( $level, $message, array $context = array() ) { |
| 26 |
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( 'error' ) ) { |
| 27 |
return; |
| 28 |
} |
| 29 |
|
| 30 |
$this->error_output .= sprintf( |
| 31 |
'[%s] %s<br>', |
| 32 |
strtoupper( $level ), |
| 33 |
$message |
| 34 |
); |
| 35 |
} |
| 36 |
} |
| 37 |
|