Oh, thanx to @JON and @Manish !
I'm using a slightly improved version that checks the data type and outputs it in a convenient way if it's an object or an array.
//PHP log helper - root/log folder (v0.57)
function wr_log($log_msg)
{
$log_path = $_SERVER['DOCUMENT_ROOT']."/log";
if (!file_exists($log_path))
{
//create dir for logs
mkdir($log_path, 0777, true);
}
$log_filename = $log_path.'/log_' . date('Y-m-d') . '.log'; //date('d-M-Y')
if( is_array($log_msg) || is_object($log_msg) ) $log = print_r($log_msg, true);
else $log = $log_msg;
file_put_contents($log_filename, $log ."\n", FILE_APPEND);
}