← Back to Examples

πŸ” Logging & Debugging

Explore the categorized logging system with runtime controls

Note: Open your browser's Developer Console (F12) to see the log messages. By default, all logging is disabled in production.

Example 1: Basic Logging Control

Enable and disable logging at runtime. Watch the console as you interact with the multiselect.

Example 2: Category-Specific Logging

Enable logging for specific categories only. This example has async search enabled - type to see DATA logs. Try enabling different categories to see different types of logs.

Example 3: Hybrid Static + Dynamic Search

Show popular items initially, then switch to web service search. Demonstrates beforeSearchCallback for accent removal.

Opens with 5 popular fruits. Type 3+ characters to search "database". Try "aΓ§aΓ­" or "acai" to see accent removal working.

πŸ“ Available Log Categories

  • INIT - Component initialization, configuration parsing, RTL detection, destruction
  • DATA - Async data loading, option parsing, adding new options, errors
  • UI - Dropdown/popover/tooltip rendering, positioning, badges display
  • INTERACTION - Clicks, selections, keyboard events, closeOnSelect behavior

πŸ’‘ Usage in Your Code

Here's how to control logging programmatically:

// Import logging utilities
import { enableLogging, setLogLevel, setCategoryLevel, disableLogging }
    from '@keenmate/web-multiselect';

// Enable all logging at debug level
enableLogging();

// Set specific log level for all categories
setLogLevel('info');  // 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'

// Enable/disable specific categories
disableLogging();  // First disable all
setCategoryLevel('UI', 'debug');  // Debug only UI operations
setCategoryLevel('DATA', 'info');  // Info level for data operations
setCategoryLevel('INTERACTION', 'silent');  // Disable interaction logs

// Disable all logging (default for production)
disableLogging();