Maak een log bestand aan in theme directory.
Gebruik:
wbmz_custom_log("Test {$variabele} test"); // info
wbmz_custom_log("Test {$variabele} test", "warning");
wbmz_custom_log("Test {$variabele} test", "error");
Voorbeeld
[2025-03-13 15:30:45] [info] mijn-bestand.php:123 => Het proces is gestart
function wbmz_log_custom($message, $level = 'info') {
$theme_dir = get_template_directory();
$log_file = $theme_dir . '/custom_log.txt';
$timestamp = date("Y-m-d H:i:s"); // Tijdstip van de log
$file = basename(__FILE__);
$line = __LINE__;
$formatted_message = "[$timestamp] [{$level}] $file:$line => $message" . PHP_EOL;
file_put_contents($log_file, $formatted_message, FILE_APPEND);
}