function log_file($log, $var = null, $file = 'logs/main.log', $overwrite = false) { $date = date('Y-m-d H:i:s'); $log = '----Logged on ' . $date . ' ----' . PHP_EOL . PHP_EOL . '$' . $var . ': ' . (is_array($log) ? print_r($log, true) : $log) . PHP_EOL . PHP_EOL; file_save_($file, $log, $overwrite); return true; }
function file_save($file, $string, $overwrite = false) { if (is_array($string)) { $string = serialize($string); } return file_save_($file, $string, $overwrite); }
function log_file($log, $var = null, $file = null, $overwrite = false) { $file = log_file_location($file); $log = '----Logged on ' . date('r') . ' ----' . PHP_EOL . PHP_EOL . '$' . $var . ': ' . ((is_array($log) or is_object($log)) ? print_r($log, true) : $log) . PHP_EOL . PHP_EOL; file_save_($file, $log, $overwrite); return true; }