function logs($data,$title = '',$file_name = '',$path = 'work/'){
$type = gettype($data);
if ($type == 'object') {
$data = print_r($data,true);
}else{
if ($type != 'string') {
$data = var_export($data,true);
}
}
if ($file_name == '') {
$file_name = date('Y-m-d').'.log';
}else{
$date = date('Y-m-d');
$file_name = "{$file_name}_{$date}.log";
}
$path = RUNTIME_PATH.$path;
if (!is_dir($path)) {
mkdir($path);
}
$date = date('Y-m-d H:i:s');
$file_name = $path.$file_name;
$text = "========================={$date}==={$title}=========================".PHP_EOL;
$text .= $data;
$text .= PHP_EOL ."=============================END NEXT========================".PHP_EOL.PHP_EOL.PHP_EOL.PHP_EOL;
file_put_contents($file_name,$text,FILE_APPEND);
}