Created
April 20, 2012 11:27
-
-
Save eabait/2427905 to your computer and use it in GitHub Desktop.
Simple remote debugging for web mobile development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$debugFile = dirname(__FILE__) . '/debug.log'; | |
$date = date('Y:m:d G:i:s') . "\n"; | |
$line = str_repeat('-', 80); | |
//log request | |
$message = print_r($_REQUEST, true); | |
$message = "\n" . $line . "\n" . $date . "\n" . $message . "\n" . $line; | |
$file = fopen($debugFile,'a'); | |
fwrite($file, $message); | |
fclose($file); | |
echo "request written to: $debugFile"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Taken from Alberto's Miranda post: http://metacodigo.com.ar/?p=412 | |
* The main idea is to change console.log for an | |
* ajax call to the server which logs the | |
* message in a file | |
*/ | |
console.log = function(msg){ | |
//set your remote debugging server ip and path here | |
var debuggerUrl = 'http://192.168.0.200/debug.php'; | |
$.ajax({ | |
url: debuggerUrl, | |
type: 'POST', | |
data: { | |
message: msg | |
}, | |
error: function(response){ | |
alert('Oops... unable to write log!'); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment