Skip to content

Instantly share code, notes, and snippets.

@DevWael
Created September 24, 2018 16:49
Show Gist options
  • Save DevWael/b23ff303f157233053bccdc18431acc5 to your computer and use it in GitHub Desktop.
Save DevWael/b23ff303f157233053bccdc18431acc5 to your computer and use it in GitHub Desktop.
function to create log file to test data in backend (Development Purposes Only)
<?php
function dev_log( $log_data ) {
$log_file_name = "log";
if ( ! file_exists( $log_file_name ) ) {
mkdir( $log_file_name, 0777, true );
}
$log_file_data = $log_file_name . '/log_' . date( 'd-M-Y' ) . '.log';
file_put_contents( $log_file_data, $log_data . "\n", FILE_APPEND );
}
//For wordpress developers: put this function into your plugin or theme (functions.php) and call it to test your data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment