log-haze-client
v0.0.1
Published
Client library for sending events to LogHaze VS Code extension
Maintainers
Readme
log-haze-client
A simple client library for sending events to the LogHaze VS Code extension.
Installation
npm install log-haze-clientUsage
In Node.js / Next.js
import { sendEvent } from 'log-haze-client';
// Send an API event
sendEvent('api', 'User logged in', {
status: 200,
duration: 150,
meta: { userId: 123 }
});
// Send a log event
sendEvent('log', 'Page loaded', {
meta: { page: '/dashboard' }
});
// Send an error event
sendEvent('error', 'Failed to fetch data', {
detail: 'Network timeout',
meta: { endpoint: '/api/users' }
});
// Send an action event
sendEvent('action', 'Button clicked', {
meta: { buttonId: 'submit' }
});In Browser (without build tools)
<script src="https://unpkg.com/log-haze-client"></script>
<script>
LogHaze.sendEvent('action', 'Button clicked');
</script>Event Types
api- API calls and network requestslog- General logging and info messageserror- Errors and exceptionsaction- User actions and interactions
Event Payload
Each event can include:
kind: Event type (required)title: Short description (required)detail: Optional longer messagestatus: HTTP status code or similarduration: Time in millisecondsmeta: Any additional JSON data
Requirements
- The LogHaze VS Code extension must be installed and running
- The extension automatically hosts a WebSocket server on
ws://localhost:7842 - The client connects automatically and handles reconnections
License
MIT
