Log Stream Model - Real-time streaming log viewer with efficient block-based management and async iteration.

This model provides high-performance log streaming capabilities for monitoring KOS device logs in real-time. It organizes log data into efficient blocks for memory management and provides async iterator support for continuous log consumption. Essential for debugging, monitoring, and troubleshooting KOS applications.

Key Features

  • Real-time Log Streaming - Live log updates as they are generated on the device
  • Block-based Management - Efficient memory usage through log block organization
  • Async Iterator Support - Stream logs using modern async/await patterns
  • Subscription Control - Subscribe/unsubscribe to specific log streams
  • Line Number Tracking - Maintains accurate line numbering across blocks
  • Multi-stream Support - Handle multiple log streams simultaneously through container model

Common Use Cases

  • Development Debugging - Monitor application logs during development
  • Production Monitoring - Track system health and errors in deployed applications
  • Troubleshooting - Analyze log patterns to diagnose issues
  • Log Analysis - Process log streams for metrics and insights
  • Real-time Dashboards - Display live log feeds in monitoring interfaces
  • Automated Log Processing - Stream logs to external analysis tools

Example: Basic Usage

const logStream = LogStream.instance('application-logs')
.options({ name: 'application-logs', nodeId: 'primary' })
.build();

await logStream.subscribe();
const iterator = logStream.start();
for await (const logLine of iterator) {
console.log(`[LOG] ${logLine}`);
}

Use Declared Type

See

interface LogStreamModel {
    reset(): Promise<void>;
}

Methods

Methods

  • -------------------LIFECYCLE----------------------------

    Returns Promise<void>