1. Home
  2. Docs
  3. 3D
  4. Troubleshooting & Deb...
  5. JavaScript Logger

JavaScript Logger

PHP Logger

The plugin includes a Logger class for recording debug information during PHP execution. Logs are stored in wp_options and are viewable from the plugin’s admin debug panel.

Accessing the Logger
$logger = wp3dconf()->logger;

Methods
MethodLevelDescription
info( $message, $context )INFOGeneral informational messages
warning( $message, $context )WARNINGNon-critical issues worth monitoring
error( $message, $context )ERRORFailures that need attention
debug( $message, $context )DEBUGVerbose development output
$logger = wp3dconf()->logger;

$logger->info( 'Order submitted', [ 'order_id' => 123 ] );
$logger->warning( 'API rate limit approaching', [ 'requests' => 950, 'limit' => 1000 ] );
$logger->error( 'Payment failed', [ 'order_id' => 456, 'reason' => 'Card declined' ] );
$logger->debug( 'Processing step', [ 'step' => 'validation', 'order_id' => 789 ] );

What Each Entry Captures

Every log entry automatically records:

FieldDescription
timestampMySQL datetime at time of logging
levelINFO, WARNING, ERROR, or DEBUG
messageThe message string
contextThe $context array
fileBasename of the calling file
lineLine number of the calling code
user_idID of the currently logged-in WordPress user
ipRemote IP address

Retrieving & Exporting Logs

$logger = wp3dconf()->logger;

// Get all stored log entries
$logs = $logger->get_logs();

// Export as plain text — useful for support tickets or bug reports
$text = $logger->export_as_text();

// Clear all stored logs
$logger->clear_logs();

Logs are stored in wp_options under the key wp3dconf_debug_logs, newest first, capped at the last 50 entries.

Usage in an Addon

add_action( 'wp3dconf/frontend/before_skin_display', function( $skin_instance, $post_id ) {
wp3dconf()->logger->debug( 'Rendering skin', [
'skin_id' => $skin_instance->get_skin_id(),
'post_id' => $post_id,
] );
}, 10, 2 );

How can we help?