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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user