This is an example function that will print an object or array elements in your own logger.
/**
* Debugging to log an object or array
*
* @param array $var
* @param int $depth
* @param int $currentLevel
*/
public function printrLimited($var, $depth = 2, $currentLevel = 0)
{
if ($currentLevel > $depth) {
return;
}
if (is_array($var) || is_object($var)) {
foreach ($var as $key => $value) {
if (is_array($value) || is_object($value)) {
continue;
}
$this->logger->info(str_repeat(' ', $currentLevel * 4) . "$key => " . $value);
}
}
}