# optimole-wp/4.2.5/assets/js/modules/logger.js

Optimole – Optimize Images | Convert WebP &amp; AVIF | CDN &amp; Lazy Load | Image Optimization, version 4.2.5. 65 lines.

- Page: https://pluginprobe.com/plugins/optimole-wp/4.2.5/code/assets/js/modules/logger.js
- Raw: https://pluginprobe.com/plugins/optimole-wp/4.2.5/raw/assets/js/modules/logger.js
- Modified: 2025-10-09T13:04:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/optimole-wp/4.2.5/code/assets/js/modules/logger.js#L10-L20`.

```javascript
/**
 * Optimole Logger Module
 * Provides centralized logging functionality with debug mode support
 */

/**
 * Create utility logger with simplified structure
 */
export const optmlLogger = {
    /**
     * Check if debug mode is enabled
     * @returns {boolean} True if debug mode is active
     */
    isDebug: function() {
      return new URLSearchParams(location.search).has('optml_debug') || 
             localStorage.getItem('optml_debug') !== null;
    },

    /**
     * Generic log method
     * @param {string} level - Log level (info, warn, error)
     * @param {...any} args - Arguments to log
     */
    log: function(level, ...args) {
      if (this.isDebug()) {
        console[level]('[Optimole]', ...args);
      }
    },

    /**
     * Log info messages
     * @param {...any} args - Arguments to log
     */
    info: function(...args) {
      this.log('info', ...args);
    },

    /**
     * Log warning messages
     * @param {...any} args - Arguments to log
     */
    warn: function(...args) {
      this.log('warn', ...args);
    },

    /**
     * Log error messages
     * @param {...any} args - Arguments to log
     */
    error: function(...args) {
      this.log('error', ...args);
    },

    /**
     * Log table data
     * @param {Object|Array} data - Data to display in table format
     */
    table: function(data) {
      if (this.isDebug()) {
        console.log('[Optimole] Table:');
        console.table(data);
      }
    }
};

```
