-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add debug logging to rules handling and honeypot precheck
- Loading branch information
1 parent
0b4f8e7
commit adb250e
Showing
4 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace AntispamBee\Helpers; | ||
|
||
class DebugMode { | ||
protected static $debug_mode_enabled = null; | ||
|
||
public static function enabled() { | ||
if ( static::$debug_mode_enabled === null ) { | ||
static::$debug_mode_enabled = defined( 'ANTISPAM_BEE_DEBUG_MODE_ENABLED' ) ? \ANTISPAM_BEE_DEBUG_MODE_ENABLED : false; | ||
} | ||
|
||
return static::$debug_mode_enabled; | ||
} | ||
|
||
public static function log( string $message ) { | ||
if ( ! static::enabled() ) { | ||
return; | ||
} | ||
|
||
$date = date( 'Y-m-d' ); | ||
$content_dir = \WP_CONTENT_DIR; | ||
error_log( "Antispam Bee – $message\n", 3, "{$content_dir}/asb-debug.{$date}.log" ); | ||
} | ||
} |
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