Skip to main content

How to pretty print arrays with logger in Drupal 8

This is a nice way for drupal 8 to log array data in some readable format.

  \Drupal::logger('what_a_nice_logName')->warning('<pre><code>' . print_r($jsonObj, TRUE) . '</code></pre>');

 

logger