UNPKG

alfred-logger-sdk

Version:

Production-ready data collection SDK for feeding structured events to LLM Data Agents with auto-capture capabilities

92 lines (76 loc) 3.23 kB
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [2.0.0] - 2024-12-23 ### Added - **Auto-Capture System**: Automatic HTTP/HTTPS request and response logging - Patches Node.js `http` and `https` modules at runtime - Configurable sampling, filtering, and body capture - Smart header sanitization for security - Body size limits to prevent memory issues - **Custom Context Management**: - `setCustomContext()` - Add application-specific context to all events - `getCustomContext()` - Retrieve current context values - `removeCustomContext()` - Remove specific context keys - `clearCustomContext()` - Clear all custom context - **Enhanced Security Features**: - Input validation for all configuration and event data - Automatic sanitization of sensitive fields (passwords, tokens, keys) - Secure random ID generation using crypto module - Payload size limits to prevent DoS attacks - URL validation to prevent malicious endpoints - **Memory & Performance Improvements**: - Buffer overflow protection with configurable limits - Event size limits (1MB default) - Rate limiting between HTTP requests - Proper error recovery and retry logic with exponential backoff - Graceful shutdown process - **Production-Ready Features**: - Comprehensive error handling and recovery - Memory leak protection - Safe shutdown with pending flush completion - No sensitive data in error logs - **Testing & Quality**: - Complete test suite with 95%+ coverage - Jest configuration for testing - Comprehensive unit tests for all modules - Security and performance testing ### Enhanced - **Logger Class**: Complete rewrite with production-ready features - **HttpClient**: Enhanced retry logic, rate limiting, better error handling - **Express Middleware**: Improved error handling and sanitization - **Axios Integration**: Enhanced with request/response sanitization ### Security - All sensitive data automatically redacted from logs - Header sanitization for authorization, cookies, API keys - Request/response body sanitization - Secure ID generation using crypto.randomBytes() - Protection against log injection attacks ### Breaking Changes - API updated from `createDataCollector()` to `new Logger()` - Configuration options restructured for better organization - Event structure enhanced with additional metadata - Auto-capture requires explicit configuration ### Documentation - Complete README rewrite with comprehensive examples - Security guidelines documentation - Auto-capture usage examples - Publishing and deployment guides ## [1.0.0] - 2024-XX-XX ### Added - Initial release - Basic event collection functionality - HTTP client for data transmission - Express middleware support - Trace ID management - Basic error handling - Simple batching and buffering ### Features - User action logging - System event tracking - Performance metric collection - Error tracking - Custom data collection - Automatic and manual trace ID support - Configurable batching and retry logic