SDK Overview
Logstyx provides JavaScript SDKs for various platforms and frameworks, making it easy to integrate logging into your applications. All SDKs are built on top of logstyx-js-core and provide a consistent API across different environments.
Available SDKs
Core SDK
The foundation for all platform-specific SDKs. Use this if you're building a custom integration or need maximum flexibility.
Repository: logstyx-js-core
npm install github:devatlogstyx/logstyx-js-core#releaseWhen to use Core SDK
- Building a custom integration for a framework not yet supported
- Need low-level control over logging behavior
- Creating your own wrapper around Logstyx
Node.js SDK
For server-side Node.js applications. Includes automatic uncaught exception and unhandled rejection capture.
Repository: logstyx-js-node
npm install github:devatlogstyx/logstyx-js-node#releaseBest for: Backend services, APIs, CLI tools, serverless functions
Express SDK
Middleware for Express.js applications with automatic request logging.
Repository: logstyx-js-express
npm install github:devatlogstyx/logstyx-js-express#releaseBest for: Express.js web servers and REST APIs
Browser SDK
Lightweight SDK for vanilla JavaScript in the browser.
Repository: logstyx-js-browser
npm install github:devatlogstyx/logstyx-js-browser#releaseBest for: Static websites, vanilla JS applications
React SDK
React hooks and components for seamless integration.
Repository: logstyx-js-react
npm install github:devatlogstyx/logstyx-js-react#releaseBest for: React web applications
React Native SDK
Optimized for React Native mobile applications.
Repository: logstyx-js-react-native
npm install github:devatlogstyx/logstyx-js-react-native#releaseBest for: iOS and Android mobile apps built with React Native
Common Features
All Logstyx SDKs share these core capabilities:
- Structured logging with multiple log levels (info, warning, error, critical)
- Context management for adding metadata to logs
- Automatic payload sanitization to ensure valid log entries
- Self-hosted support via custom endpoint configuration
- Type safety with built-in validation
Installation
All SDKs are currently installed directly from GitHub:
# General pattern
npm install github:devatlogstyx/{sdk-name}#releaseDevelopment Note
SDKs are currently distributed via GitHub releases.
Basic Usage
All SDKs follow a similar initialization pattern:
const logger = useLogstyx({
projectId: 'your_project_id',
apiKey: 'your_api_key', // Server-side only
endpoint: 'https://your-domain.com/api/v1/logs' // Optional: for self-hosted
});
// Send logs
logger.info({ message: 'User logged in', userId: '123' });
logger.error({ message: 'Payment failed', error: err.message });Authentication
Authentication requirements differ by environment:
Server-side (Node.js, Express):
- Requires
apiKeyfor HMAC signature authentication - More secure as keys never leave your server
Client-side (Browser, React, React Native):
- Browser/React uses origin-based authentication
- Requires
appidfor React Native - Both need allowed Origin to be set on the project setting
Self-Hosted Configuration
When using a self-hosted Logstyx instance, configure the endpoint:
const logger = useLogstyx({
projectId: 'your_project_id',
endpoint: 'https://your-domain.com/api/v1/logs',
// ... other options
});