Live Mode
Live mode is the default development path. The SDK opens a WebSocket endpoint and broadcasts each log entry.
Typical flow
- Your service calls
init(...)withisDev: true. - SDK starts a WebSocket server (
portdefault:8080). - Open the live viewer at https://binhonglee.github.io/slogx/app.
- Connect to
localhost:<port>and inspect logs in real time.
Example
slogx.init({
isDev: true,
port: 8080,
serviceName: 'my-service',
ciMode: false,
});
slogx.debug('cache miss', { key: 'user:42' });
slogx.error('query failed', new Error('timeout'));
Notes
isDevis a safety gate to avoid accidental production use.- If
ciModeistrue, WebSocket mode is bypassed. - If no client is connected, logs still go through call-site processing but are not shown in the viewer.