清理调试日志

This commit is contained in:
YHH
2025-10-16 12:21:18 +08:00
parent 345ef70972
commit 6bcfd48a2f
4 changed files with 1 additions and 36 deletions

View File

@@ -36,7 +36,6 @@ export function EntityInspector({ entityStore: _entityStore, messageHub }: Entit
const handleEntityDetails = (event: Event) => {
const customEvent = event as CustomEvent;
const details = customEvent.detail;
console.log('[EntityInspector] Received entity details:', details);
setRemoteEntityDetails(details);
};
@@ -61,9 +60,7 @@ export function EntityInspector({ entityStore: _entityStore, messageHub }: Entit
return;
}
console.log('Attempting to create component:', componentName);
const component = componentRegistry.createInstance(componentName);
console.log('Created component:', component);
if (component) {
selectedEntity.addComponent(component);

View File

@@ -48,19 +48,14 @@ export function SceneHierarchy({ entityStore, messageHub }: SceneHierarchyProps)
const profilerService = (window as any).__PROFILER_SERVICE__ as ProfilerService | undefined;
if (!profilerService) {
console.warn('[SceneHierarchy] ProfilerService not available');
return;
}
console.log('[SceneHierarchy] Subscribing to ProfilerService');
const unsubscribe = profilerService.subscribe((data) => {
const connected = profilerService.isConnected();
console.log('[SceneHierarchy] Received data, connected:', connected, 'entities:', data.entities?.length || 0);
setIsRemoteConnected(connected);
if (connected && data.entities && data.entities.length > 0) {
console.log('[SceneHierarchy] Setting remote entities:', data.entities);
setRemoteEntities(data.entities);
} else {
setRemoteEntities([]);

View File

@@ -125,8 +125,7 @@ export class ProfilerService {
private async startServer(): Promise<void> {
try {
const port = parseInt(this.wsPort);
const result = await invoke<string>('start_profiler_server', { port });
console.log('[ProfilerService]', result);
await invoke<string>('start_profiler_server', { port });
this.isServerRunning = true;
} catch (error) {
console.error('[ProfilerService] Failed to start server:', error);
@@ -137,16 +136,13 @@ export class ProfilerService {
if (this.ws) return;
try {
console.log(`[ProfilerService] Connecting to ws://localhost:${this.wsPort}`);
const ws = new WebSocket(`ws://localhost:${this.wsPort}`);
ws.onopen = () => {
console.log('[ProfilerService] Connected to profiler server');
this.notifyListeners(this.createEmptyData());
};
ws.onclose = () => {
console.log('[ProfilerService] Disconnected from profiler server');
this.ws = null;
// 如果服务器还在运行,尝试重连
@@ -186,7 +182,6 @@ export class ProfilerService {
public requestEntityDetails(entityId: number): void {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
console.warn('[ProfilerService] Cannot request entity details: WebSocket not connected');
return;
}
@@ -196,7 +191,6 @@ export class ProfilerService {
requestId: `entity_details_${entityId}_${Date.now()}`,
entityId
};
console.log('[ProfilerService] Requesting entity details:', request);
this.ws.send(JSON.stringify(request));
} catch (error) {
console.error('[ProfilerService] Failed to request entity details:', error);
@@ -251,7 +245,6 @@ export class ProfilerService {
private requestRawEntityList(): void {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
console.warn('[ProfilerService] Cannot request entity list: WebSocket not connected');
return;
}
@@ -260,7 +253,6 @@ export class ProfilerService {
type: 'get_raw_entity_list',
requestId: `entity_list_${Date.now()}`
};
console.log('[ProfilerService] Requesting entity list:', request);
this.ws.send(JSON.stringify(request));
} catch (error) {
console.error('[ProfilerService] Failed to request entity list:', error);
@@ -269,12 +261,9 @@ export class ProfilerService {
private handleRawEntityListResponse(data: any): void {
if (!data || !Array.isArray(data)) {
console.warn('[ProfilerService] Invalid raw entity list response:', data);
return;
}
console.log('[ProfilerService] Received raw entity list, count:', data.length);
const entities: RemoteEntity[] = data.map((e: any) => ({
id: e.id,
name: e.name || `Entity ${e.id}`,
@@ -298,12 +287,9 @@ export class ProfilerService {
private handleEntityDetailsResponse(data: any): void {
if (!data) {
console.warn('[ProfilerService] Invalid entity details response:', data);
return;
}
console.log('[ProfilerService] Received entity details:', data);
const entityDetails: RemoteEntityDetails = {
id: data.id,
name: data.name || `Entity ${data.id}`,

View File

@@ -28,8 +28,6 @@ export class ComponentLoaderService implements IService {
componentInfos: ComponentFileInfo[],
modulePathTransform?: (filePath: string) => string
): Promise<LoadedComponentInfo[]> {
logger.info(`Loading ${componentInfos.length} components`);
const loadedComponents: LoadedComponentInfo[] = [];
for (const componentInfo of componentInfos) {
@@ -48,7 +46,6 @@ export class ComponentLoaderService implements IService {
components: loadedComponents
});
logger.info(`Successfully loaded ${loadedComponents.length} components`);
return loadedComponents;
}
@@ -66,20 +63,15 @@ export class ComponentLoaderService implements IService {
if (modulePathTransform) {
const modulePath = modulePathTransform(componentInfo.path);
logger.info(`Attempting to load component from: ${modulePath}`);
logger.info(`Looking for export: ${componentInfo.className}`);
try {
const module = await import(/* @vite-ignore */ modulePath);
logger.info(`Module loaded, exports:`, Object.keys(module));
componentClass = module[componentInfo.className] || module.default;
if (!componentClass) {
logger.warn(`Component class ${componentInfo.className} not found in module exports`);
logger.warn(`Available exports: ${Object.keys(module).join(', ')}`);
} else {
logger.info(`Successfully loaded component class: ${componentInfo.className}`);
}
} catch (error) {
logger.error(`Failed to import component module: ${modulePath}`, error);
@@ -108,8 +100,6 @@ export class ComponentLoaderService implements IService {
this.loadedComponents.set(componentInfo.path, loadedInfo);
logger.info(`Component ${componentClass ? 'loaded' : 'metadata registered'}: ${componentInfo.className}`);
return loadedInfo;
} catch (error) {
logger.error(`Failed to load component: ${componentInfo.fileName}`, error);
@@ -131,7 +121,6 @@ export class ComponentLoaderService implements IService {
this.componentRegistry.unregister(loadedComponent.fileInfo.className);
this.loadedComponents.delete(filePath);
logger.info(`Component unloaded: ${loadedComponent.fileInfo.className}`);
return true;
}
@@ -139,7 +128,6 @@ export class ComponentLoaderService implements IService {
for (const [filePath] of this.loadedComponents) {
this.unloadComponent(filePath);
}
logger.info('Cleared all loaded components');
}
private convertToModulePath(filePath: string): string {
@@ -148,6 +136,5 @@ export class ComponentLoaderService implements IService {
public dispose(): void {
this.clearLoadedComponents();
logger.info('ComponentLoaderService disposed');
}
}