diff --git a/README.md b/README.md index 8f4658f2..2d689e0c 100644 --- a/README.md +++ b/README.md @@ -535,6 +535,10 @@ output_log_file: # Set the value to true to allow them. log_allow_line_breaks: false +# By default empty context arrays are shown in the log. +# Set the value to true to remove them. +log_ignore_empty_context: false + # This option determines whether the output should be emailed or not. email_output: false diff --git a/resources/config/crunz.yml b/resources/config/crunz.yml index d5aa35ea..c3e316b0 100644 --- a/resources/config/crunz.yml +++ b/resources/config/crunz.yml @@ -43,6 +43,10 @@ output_log_file: ~ # Set the value to true to allow them. log_allow_line_breaks: false +# By default empty context arrays are shown in the log. +# Set the value to true to remove them. +log_ignore_empty_context: false + # This option determines whether the output should be emailed or not. email_output: false diff --git a/src/Configuration/Definition.php b/src/Configuration/Definition.php index a38aaef9..26be0447 100644 --- a/src/Configuration/Definition.php +++ b/src/Configuration/Definition.php @@ -68,6 +68,11 @@ public function getConfigTreeBuilder(): TreeBuilder ->info('Flag for line breaks in logs' . PHP_EOL) ->end() + ->scalarNode('log_ignore_empty_context') + ->defaultFalse() + ->info('Flag for empty context in logs' . PHP_EOL) + ->end() + ->scalarNode('email_output') ->defaultFalse() ->info('Email the event\'s output' . PHP_EOL) diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php index d1ef08e9..263f5522 100644 --- a/src/Logger/Logger.php +++ b/src/Logger/Logger.php @@ -116,11 +116,15 @@ protected function getDefaultFormatter() ->get('log_allow_line_breaks') ; + $ignoreEmptyContext = $this->configuration + ->get('log_ignore_empty_context') + ; + return new LineFormatter( null, null, $allowLinebreaks, - false + $ignoreEmptyContext ); } diff --git a/tests/crunz.yml b/tests/crunz.yml index 67aae221..6e282d39 100644 --- a/tests/crunz.yml +++ b/tests/crunz.yml @@ -7,6 +7,7 @@ errors_log_file: ~ log_output: false output_log_file: ~ log_allow_line_breaks: false +log_ignore_empty_context: false email_output: false email_errors: false mailer: