From 71ba6b26ea84dd62d83ea5f1e7a2d609c88f861e Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 12 Oct 2018 08:42:36 -0400 Subject: [PATCH] Put error logs in their own directory --- includes/init.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/init.php b/includes/init.php index a7d5ade..0df30be 100644 --- a/includes/init.php +++ b/includes/init.php @@ -20,7 +20,11 @@ add_action( 'pterotype_init', function() { \schema\run_migrations(); \actors\initialize_actors(); if ( WP_DEBUG ) { - file_put_contents( __DIR__ . '/activation_errors.log', ob_get_contents() ); + $log_dir = plugin_dir_path( __FILE__ ) . '../log'; + if ( ! file_exists( $log_dir ) ) { + mkdir( $log_dir, 0777, true ); + } + file_put_contents( $log_dir, ob_get_contents() ); } } );