win-stream-audio
Version:
đ§ Stream Windows system audio to Android devices over WiFi with professional audio controls, EQ, pitch shifting, and effects
76 lines (61 loc) âĸ 2.03 kB
JavaScript
/**
* AudioPilot - Logger Module
* Handles mission log display and debug history
*/
class Logger {
constructor(outputElement) {
this.outputElement = outputElement;
this.debugHistory = [];
this.maxDebugLines = 20;
this.historyEnabled = false;
this.log('AudioPilot System Online - Awaiting Commands...');
}
log(message) {
const timestamp = new Date().toLocaleTimeString();
const logEntry = `[${timestamp}] ${message}`;
if (this.historyEnabled) {
this.debugHistory.push(logEntry);
if (this.debugHistory.length > this.maxDebugLines) {
this.debugHistory.shift();
}
this.outputElement.textContent = this.debugHistory.join('\n');
} else {
this.outputElement.textContent = logEntry;
}
// Auto-scroll to bottom
this.outputElement.scrollTop = this.outputElement.scrollHeight;
// Also log to console for debugging
console.log(logEntry);
}
enableHistory() {
this.historyEnabled = true;
this.log('Debug history enabled - logs will accumulate');
}
disableHistory() {
this.historyEnabled = false;
this.debugHistory = [];
this.log('Debug history disabled - showing current only');
}
clear() {
this.debugHistory = [];
this.outputElement.textContent = 'AudioPilot System Online - Awaiting Commands...';
}
error(message) {
this.log('â ERROR: ' + message);
console.error(message);
}
warn(message) {
this.log('â ī¸ WARNING: ' + message);
console.warn(message);
}
info(message) {
this.log('âšī¸ INFO: ' + message);
console.info(message);
}
success(message) {
this.log('â
SUCCESS: ' + message);
console.log(message);
}
}
// Export for use in other modules
window.Logger = Logger;