Skip to content

Commit

Permalink
chore: add constant to change debug log directory
Browse files Browse the repository at this point in the history
  • Loading branch information
florianbrinkmann committed May 22, 2024
1 parent 7f569ef commit 199ed6d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Helpers/DebugMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public static function log( string $message ) {

$date = date( 'Y-m-d' );
$time = date( 'H-i-s' );
$content_dir = \WP_CONTENT_DIR;
error_log( "[{$date} {$time}] {$message}\n", 3, "{$content_dir}/asb-debug.{$date}.log" );
$log_dir = defined( 'ANTISPAM_BEE_DEBUG_MODE_LOG_DIR' ) ? \ANTISPAM_BEE_DEBUG_MODE_LOG_DIR : \WP_CONTENT_DIR;
if ( ! is_dir( $log_dir ) ) {
error_log( "The directory set for Antispam Bee debug logging does not exist: {$log_dir}" );
}
error_log( "[{$date} {$time}] {$message}\n", 3, "{$log_dir}/asb-debug.{$date}.log" );
}
}

0 comments on commit 199ed6d

Please sign in to comment.