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.Documentation Index
Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start
Enable logging by setting thelogLevel parameter when initializing Portal:
Log Levels
The SDK supports five log levels, ordered by verbosity:| Level | Description | Use Case |
|---|---|---|
'none' | No logging output (default) | Production environments |
'error' | Only errors and critical failures | Production with minimal logging |
'warn' | Errors and warnings | Staging and production |
'info' | Errors, warnings, and informational messages | Development and staging |
'debug' | All log messages including detailed debugging information | Local development only |
'none' — No logs are emitted unless you explicitly configure logging.
Logger Interface
Your custom logger must implement theILogger interface (exported from @portal-hq/web):
Custom logger example
Production logger with timestamps
For better observability, add timestamps to your logs:How logging works
- SDK handles level filtering — The SDK filters messages based on your
logLevelsetting before calling your logger methods. - Logger handles output — Your logger is responsible only for formatting and outputting the messages.
- No performance impact when disabled — When
logLevelis'none', log messages are not generated. - Fallback on logger errors — If your logger throws, the SDK falls back to
consolefor that call.
Next Steps
- MPC Progress Callbacks — Monitor MPC operation progress
- Portal API Methods — Learn about available SDK methods
- Error Codes — Understand Portal error codes