Skip to content

Instantly share code, notes, and snippets.

@madcatgith
Last active May 21, 2019 17:00
Show Gist options
  • Save madcatgith/11b8bedabcc9ccb717aea0d27c332908 to your computer and use it in GitHub Desktop.
Save madcatgith/11b8bedabcc9ccb717aea0d27c332908 to your computer and use it in GitHub Desktop.
/**
*Вывод данных в отладочную консоль javascript для Bitrix с исправленным выводом киррилицы в качестве ключа массива
**/
function console_log($data){
global $USER;
if ($USER->IsAdmin()) {
$json = json_encode(unserialize(str_replace(array('NAN;','INF;'),'0;',serialize($data))));
echo '<script>';
echo 'console.log("---------CONSOLE DEBUG-------");';
echo 'console.log(' . $json . ');';
echo 'console.log("---------END DEBUG-------");';
echo '</script>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment