Enable Discovery debug logging for production troubleshooting

- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
2025-08-11 20:13:26 +02:00
parent 59fd3dd3b1
commit 55a330b223
3683 changed files with 2956207 additions and 16948 deletions

View File

@@ -1,15 +1,23 @@
// modules/core/frameloop.js
import {Logger} from "./logger";
/**
* @typedef {Object} FrameTaskOptions
* @property {boolean} [autoStart=false] - Automatically start the frame loop
*/
/** @type {Map<string, Function>} */
const tasks = new Map();
/** @type {boolean} */
let running = false;
/** @type {boolean} */
let showDebug = false;
let lastTime = performance.now();
let frameCount = 0;
let fps = 0;
// Create debug overlay
const debugOverlay = document.createElement('div');
debugOverlay.style.position = 'fixed';
debugOverlay.style.bottom = '0';
@@ -28,8 +36,10 @@ debugOverlay.style.lineHeight = '1.4';
document.body.appendChild(debugOverlay);
import { PerformanceMonitor } from './PerformanceMonitor.js';
/** @type {PerformanceMonitor} */
export const monitor = new PerformanceMonitor();
// Debug toggle with § key
window.addEventListener('keydown', (e) => {
if (e.key === '§') {
showDebug = !showDebug;
@@ -37,19 +47,35 @@ window.addEventListener('keydown', (e) => {
}
});
/**
* Register a task to run on every frame
* @param {string} id - Unique identifier for the task
* @param {Function} callback - Function to execute each frame
* @param {FrameTaskOptions} [options={}] - Task options
*/
export function registerFrameTask(id, callback, options = {}) {
tasks.set(id, callback);
if (options.autoStart && !running) startFrameLoop();
}
/**
* Unregister a frame task
* @param {string} id - Task identifier to remove
*/
export function unregisterFrameTask(id) {
tasks.delete(id);
}
/**
* Clear all registered frame tasks
*/
export function clearFrameTasks() {
tasks.clear();
}
/**
* Start the main frame loop
*/
export function startFrameLoop() {
if (running) return;
running = true;
@@ -77,6 +103,10 @@ export function startFrameLoop() {
requestAnimationFrame(loop);
}
/**
* Stop the frame loop
* Note: Loop continues until next frame, this just sets the flag
*/
export function stopFrameLoop() {
running = false;
// Achtung: Loop läuft weiter, solange nicht aktiv gestoppt