Functions
init()
Initialize the VIJ SDK with configuration options. Must be called before using other SDK functions.Configuration object for the SDK. See Configuration Guide for detailed documentation.
captureException()
Capture and send an error to VIJ Admin.Optional metadata to attach to this error. Merged with global metadata from
init().void
captureMessage()
Capture and send a custom log message to VIJ Admin.void
flush()
Immediately flush all queued logs to the server, bypassing batch settings.Promise<void> - Resolves when all logs are sent
setMetadata()
Update global metadata that will be attached to all future logs.void
Metadata set via
setMetadata() is merged with metadata passed to init(). Later values override earlier ones.clearMetadata()
Remove specific keys from global metadata.void
getMetadata()
Retrieve the current global metadata object.Record<string, any> - Current global metadata
Types
InitOptions
Configuration options for theinit() function.
Severity
Severity level for errors and messages."error"- Critical errors requiring immediate attention"warning"- Non-critical issues that should be investigated"info"- Informational logs for tracking behavior
LogEntry
Structure of a log entry sent to VIJ Admin.You don’t create
LogEntry objects directly. The SDK generates them automatically when you call captureException() or captureMessage().BrowserContext
Contextual information collected in browser environments.NodeContext
Contextual information collected in Node.js environments.Advanced Usage
Manual Queue Management
Dynamic Metadata Updates
TypeScript Integration
React Integration
Express Integration
Best Practices
Initialize once at startup
Initialize once at startup
Call
init() once when your application starts, before any other code:Use TypeScript for type safety
Use TypeScript for type safety
Import types for better IDE support and compile-time checking:
Flush before critical operations
Flush before critical operations
Ensure logs are sent before page unload, process exit, or deployments:
Use metadata for context, not in messages
Use metadata for context, not in messages
Next Steps
Configuration Guide
Learn about all SDK configuration options
Capturing Errors
Understand error and message capture patterns
Dashboard Features
Explore VIJ Admin dashboard capabilities
API Endpoints
View the HTTP API documentation