Skip to main content
The Portal Web SDK provides built-in logging capabilities to help you debug and monitor SDK operations during development and production. The interface matches the React Native SDK for consistency across platforms.

Quick Start

Enable logging by setting the logLevel parameter when initializing Portal:

Log Levels

The SDK supports five log levels, ordered by verbosity: Default: 'none' — No logs are emitted unless you explicitly configure logging.

Logger Interface

Your custom logger must implement the ILogger interface (exported from @portal-hq/web):

Custom logger example

Production logger with timestamps

For better observability, add timestamps to your logs:

How logging works

  1. SDK handles level filtering — The SDK filters messages based on your logLevel setting before calling your logger methods.
  2. Logger handles output — Your logger is responsible only for formatting and outputting the messages.
  3. No performance impact when disabled — When logLevel is 'none', log messages are not generated.
  4. Fallback on logger errors — If your logger throws, the SDK falls back to console for that call.

Next Steps