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

PHP Logger

JavaScript Logger

WP3dConfUtils exposes a lightweight logger that is silent by default. It does not output anything to the browser console unless explicitly enabled. The enabled state is stored in localStorage and persists across page reloads — so there is zero noise for end users who happen to open DevTools.

Enabling & Disabling

Run these directly in your browser’s developer console:

// Turn logging on
WP3dConfUtils.enableLogger();

// Turn logging off
WP3dConfUtils.disableLogger();

Methods

const { log, warn, error, info, debug } = window.WP3dConfUtils;
MethodMaps toDescription
log(...args)console.logGeneral output
warn(...args)console.warnNon-critical warnings
error(...args)console.errorErrors
info(...args)console.infoInformational messages
debug(...args)console.debugVerbose debug output

All methods accept any number of arguments, identical to their native console counterparts.

Usage

window.addEventListener('wp3dconf/frontend:ready', function() {
  const { addAction } = window.WP3dConf;
  const { log, warn } = window.WP3dConfUtils;

  addAction('wp3dconf/frontend/layer/activated', function({ uid, layer }) {
    log('Layer activated:', uid, layer);
  }, 10);

  addAction('wp3dconf/frontend/data/priceUpdated', function({ store }) {
    log('Price updated:', store.price);
  }, 10);
});

window.addEventListener('wp3dconf/editor:ready', function() {
  const { addAction } = window.WP3dConf;
  const { log, warn } = window.WP3dConfUtils;

  addAction('wp3dconf/editor/configurator-saved', function({ store }) {
    log('Configurator saved. Layer count:', Object.keys(store.layers).length);
  }, 10);

  addAction('wp3dconf/editor/layer-deleted', function({ layer }) {
    warn('Layer deleted — this cannot be undone:', layer);
  }, 10);
});

How can we help?