Last active
November 28, 2022 12:26
-
-
Save guillefd/eb9b99880d076dabb9090c4d3da12308 to your computer and use it in GitHub Desktop.
Moodle plugin development > Debug to File
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
<?php | |
function debug_log($var, $label = '') { | |
$labelcontent = $label ? $label.' ' : ''; | |
$content = PHP_EOL | |
.date('Y-m-d H:i:s').' ' | |
.$labelcontent | |
.print_r($var, TRUE) | |
.PHP_EOL; | |
error_log($content, 3, dirname(__FILE__).'/debug.log'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will create a debug file on the root of the plugin.
This function does not comply with Moodle coding guidelines, so delete when publishing.