Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function debugfile2($message, $logName = "", $fileName = "debug",$path = "/upload/debug/") {
- $logName = $logName ? (string)$logName : "";
- if (is_array($message) || is_object($message)) {
- $message = print_r($message, true);
- } elseif (is_bool($message)) {
- $message = $message ? "true" : "false";
- } elseif (is_null($message)) {
- $message = "null";
- }
- $time = (new \DateTime())->format("H:i:s d:m:Y");
- $log_path = $_SERVER['DOCUMENT_ROOT'].$path;
- CheckDirPath($log_path,true);
- $log_file = $log_path.$fileName.".html";
- $info = debug_backtrace();
- $info = $info[0];
- $info['file'] = substr($info['file'],strlen($_SERVER['DOCUMENT_ROOT']));
- $where = "{$info['file']}:{$info['line']}";
- $log = '<table style="border:1px solid #008B8B;margin:2px;">
- <tr><td><div style="font-family:verdana; font-size: 10px; font-weight: normal">'.$time.'</div></td></tr>
- <tr><td><div style="font-family:verdana; font-size: 10px; font-weight: normal">'.$where.'</div></td></tr>'.
- ($logName != "" ? '<tr><td><div style="font-family:verdana; font-size: 12px; font-weight: bold">'.$logName.'</div></td></tr>' : "")
- .'<tr><td><hr></td></tr>
- <tr><td><pre>'.$message.'</pre></td></tr>
- </table>';
- file_put_contents($log_file,$log."\r\n", FILE_APPEND);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement