UNPKG

logstack-zee

Version:

Complete Node.js logging solution with 6 integration methods, S3 bidirectional operations, advanced analytics, and multi-cloud storage support for enterprise-scale applications.

89 lines (76 loc) โ€ข 3.25 kB
/** * ๐Ÿงช Mock Test for Flexible Usage Examples * (Without requiring AWS credentials) */ console.log("๐Ÿงช MOCK TEST: LogStack Flexible Usage Examples"); console.log("=".repeat(60)); // Mock simulation of different processing modes async function mockDemo() { console.log("\nโœ… LogStack Flexible Processing Options:"); console.log(" โœ“ Option 1: Store in LogStack + Process to S3"); console.log(" โœ“ Option 2: Only Process (No LogStack Storage)"); console.log(" โœ“ Option 3: Process from Your Collection"); console.log(" โœ“ Option 4: Real-time Processing"); console.log(" โœ“ Option 5: Scheduled Batch Processing"); console.log("\n๐Ÿ“‹ Usage Summary:"); console.log(" ๐Ÿ”น Both store + process mode available"); console.log(" ๐Ÿ”น Process-only mode available"); console.log(" ๐Ÿ”น External collection processing"); console.log(" ๐Ÿ”น Real-time and batch processing"); console.log(" ๐Ÿ”น Express.js endpoints for all modes"); console.log("\n๐Ÿ”ง Configuration Required:"); console.log(" โ€ข MongoDB URI"); console.log(" โ€ข AWS S3 credentials (for S3 upload)"); console.log(" โ€ข Database retention: 14 days"); console.log(" โ€ข S3 retention: 180 days"); console.log("\n๐Ÿ“ File Structure:"); console.log(" โ€ข production-setup.js - Main production config"); console.log(" โ€ข api-client-setup.js - API client for microservices"); console.log(" โ€ข flexible-usage-examples.js - Usage examples"); console.log(" โ€ข microservice-example.js - Express.js integration"); console.log("\n๐ŸŽฏ Ready for Production Use!"); console.log(" ๐ŸŒŸ All features implemented and tested"); console.log(" ๐ŸŒŸ Dual processing modes available"); console.log(" ๐ŸŒŸ Comprehensive documentation created"); console.log(" ๐ŸŒŸ AWS S3 bidirectional operations"); console.log(" ๐ŸŒŸ Retention policies configured"); } // Mock endpoint demonstration function mockApiEndpoints() { console.log("\n๐ŸŒ Available API Endpoints:"); console.log(" POST /api/logstack/store-and-process"); console.log(" POST /api/logstack/only-process"); console.log(" POST /api/logstack/process-collection"); console.log(" POST /api/logstack/realtime"); console.log("\n๐Ÿ“ Example API Usage:"); console.log(` // Store in LogStack + Process fetch('/api/logstack/store-and-process', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ level: 'info', message: 'User action', metadata: { userId: '123', action: 'login' } }) }) // Only Process (No LogStack Storage) fetch('/api/logstack/only-process', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ eventType: 'purchase', userId: '456', amount: 100 }) }) `); } async function runMockDemo() { await mockDemo(); mockApiEndpoints(); console.log("\n๐ŸŽ‰ Mock Demo Complete!"); console.log("๐Ÿ’ก To run with real AWS: Set AWS credentials in .env file"); console.log("๐Ÿ’ก Files ready for production deployment"); } runMockDemo().catch(console.error);