xylog-sdk
v1.0.0
Published
A lightweight npm module to collect and send console logs to XYLog server
Readme
XYLog SDK
XYLog SDK is a lightweight library for collecting and sending console logs to an XYLog server. It supports both Browser and Node.js environments.
Installation
npm install xylog-sdkUsage
Browser
Using a script tag:
<script src="path/to/xylog-sdk.js"></script>
<script>
// Initialize with server URL
new XYLogSDK({
serverUrl: 'ws://your-xylog-server:3000'
});
</script>Using ES Modules / Webpack:
import XYLogSDK from 'xylog-sdk';
new XYLogSDK({
serverUrl: 'ws://your-xylog-server:3000'
});Node.js
const XYLogSDK = require('xylog-sdk');
new XYLogSDK({
serverUrl: 'ws://your-xylog-server:3000'
});
console.log('This log will be sent to the server');Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| serverUrl | string | ws://localhost:3000 | The WebSocket URL of the XYLog server |
| enable | boolean | true | Whether to enable log sending |
License
MIT
