Engine Command Manage console.log

Make coredump console log output more readable and traceable.
This commit is contained in:
Dan Shaw
2024-05-29 09:33:39 -07:00
parent ec20e9752f
commit c56319fb74

View File

@ -1,6 +1,5 @@
import { EngineCommandManager } from 'lang/std/engineConnection' import { EngineCommandManager } from 'lang/std/engineConnection'
import { WebrtcStats } from 'wasm-lib/kcl/bindings/WebrtcStats' import { WebrtcStats } from 'wasm-lib/kcl/bindings/WebrtcStats'
import { ClientState } from 'wasm-lib/kcl/bindings/ClientState'
import { OsInfo } from 'wasm-lib/kcl/bindings/OsInfo' import { OsInfo } from 'wasm-lib/kcl/bindings/OsInfo'
import { isTauri } from 'lib/isTauri' import { isTauri } from 'lib/isTauri'
import { import {
@ -161,13 +160,12 @@ export class CoreDumpManager {
// Initialize the clientState object // Initialize the clientState object
let clientState = { let clientState = {
// singletons
engine_command_manager: { engine_command_manager: {
artifact_map: {}, artifact_map: {},
command_logs: [], command_logs: [],
engine_connection: { state: { type: '' } }, engine_connection: { state: { type: '' } },
default_planes: {}, default_planes: {},
in_sequence: 0, // TODO: is this actually a good default value
out_sequence: 0, // TODO: is this actually a good default value
scene_command_artifacts: {}, scene_command_artifacts: {},
}, },
kcl_manager: { kcl_manager: {
@ -175,6 +173,7 @@ export class CoreDumpManager {
kcl_errors: [], kcl_errors: [],
}, },
scene_infra: {}, scene_infra: {},
// xstate
auth_machine: {}, auth_machine: {},
command_bar_machine: {}, command_bar_machine: {},
file_machine: {}, file_machine: {},
@ -190,14 +189,14 @@ export class CoreDumpManager {
// engine_command_manager // engine_command_manager
console.log( console.log(
'CoreDump: the engineCommandManager singlton', 'CoreDump: engineCommandManager',
this.engineCommandManager this.engineCommandManager
) )
// artifact map - this.engineCommandManager.artifactMap // artifact map - this.engineCommandManager.artifactMap
if (this.engineCommandManager?.artifactMap) { if (this.engineCommandManager?.artifactMap) {
console.log( console.log(
'CoreDump: artifact map', 'CoreDump: Engine Command Manager artifact map',
this.engineCommandManager.artifactMap this.engineCommandManager.artifactMap
) )
clientState.engine_command_manager.artifact_map = deepClone( clientState.engine_command_manager.artifact_map = deepClone(
@ -208,7 +207,7 @@ export class CoreDumpManager {
// command logs - this.engineCommandManager.commandLogs // command logs - this.engineCommandManager.commandLogs
if (this.engineCommandManager?.commandLogs) { if (this.engineCommandManager?.commandLogs) {
console.log( console.log(
'CoreDump: command logs', 'CoreDump: Engine Command Manager command logs',
this.engineCommandManager.commandLogs this.engineCommandManager.commandLogs
) )
clientState.engine_command_manager.command_logs = deepClone( clientState.engine_command_manager.command_logs = deepClone(
@ -219,7 +218,7 @@ export class CoreDumpManager {
// default planes - this.engineCommandManager.defaultPlanes // default planes - this.engineCommandManager.defaultPlanes
if (this.engineCommandManager?.defaultPlanes) { if (this.engineCommandManager?.defaultPlanes) {
console.log( console.log(
'CoreDump: default planes', 'CoreDump: Engine Command Manager default planes',
this.engineCommandManager.defaultPlanes this.engineCommandManager.defaultPlanes
) )
clientState.engine_command_manager.default_planes = deepClone( clientState.engine_command_manager.default_planes = deepClone(
@ -232,7 +231,7 @@ export class CoreDumpManager {
clientState.engine_command_manager.engine_connection.state = clientState.engine_command_manager.engine_connection.state =
this.engineCommandManager.engineConnection.state this.engineCommandManager.engineConnection.state
console.log( console.log(
'CoreDump: engine connection state', 'CoreDump: Engine Command Manager engine connection state',
this.engineCommandManager.engineConnection.state this.engineCommandManager.engineConnection.state
) )
} }
@ -240,7 +239,7 @@ export class CoreDumpManager {
// in sequence - this.engineCommandManager.inSequence // in sequence - this.engineCommandManager.inSequence
if (this.engineCommandManager?.inSequence) { if (this.engineCommandManager?.inSequence) {
console.log( console.log(
'CoreDump: in sequence', 'CoreDump: Engine Command Manager in sequence',
this.engineCommandManager.inSequence this.engineCommandManager.inSequence
) )
clientState.engine_command_manager.in_sequence = clientState.engine_command_manager.in_sequence =
@ -250,7 +249,7 @@ export class CoreDumpManager {
// out sequence - this.engineCommandManager.outSequence // out sequence - this.engineCommandManager.outSequence
if (this.engineCommandManager?.inSequence) { if (this.engineCommandManager?.inSequence) {
console.log( console.log(
'CoreDump: out sequence', 'CoreDump: Engine Command Manager out sequence',
this.engineCommandManager.outSequence this.engineCommandManager.outSequence
) )
clientState.engine_command_manager.out_sequence = clientState.engine_command_manager.out_sequence =
@ -260,7 +259,7 @@ export class CoreDumpManager {
// scene command artifacts - this.engineCommandManager.sceneCommandArtifacts // scene command artifacts - this.engineCommandManager.sceneCommandArtifacts
if (this.engineCommandManager?.sceneCommandArtifacts) { if (this.engineCommandManager?.sceneCommandArtifacts) {
console.log( console.log(
'CoreDump: scene command artifacts', 'CoreDump: Engine Command Manager scene command artifacts',
this.engineCommandManager.sceneCommandArtifacts this.engineCommandManager.sceneCommandArtifacts
) )
clientState.engine_command_manager.scene_command_artifacts = deepClone( clientState.engine_command_manager.scene_command_artifacts = deepClone(
@ -344,23 +343,23 @@ export class CoreDumpManager {
// TODO: /src/lib/singletons.ts also defines the following singletons // TODO: /src/lib/singletons.ts also defines the following singletons
// sceneEntitiesManager // sceneEntitiesManager
console.log( console.log(
'CoreDump: TODO? sceneEntitiesManager', 'CoreDump: sceneEntitiesManager',
globalThis?.window?.sceneEntitiesManager globalThis?.window?.sceneEntitiesManager
) )
// editorManager // editorManager
console.log( console.log(
'CoreDump: TODO? editorManager', 'CoreDump: editorManager',
globalThis?.window?.editorManager globalThis?.window?.editorManager
) )
// enableMousePositionLogs // enableMousePositionLogs - Not coredumped
console.log( console.log(
'CoreDump: TODO? enableMousePositionLogs', 'CoreDump: enableMousePositionLogs [not coredumped]',
globalThis?.window?.enableMousePositionLogs globalThis?.window?.enableMousePositionLogs
) )
// XState Machines // XState Machines
console.log( console.log(
'CoreDump: xstateServices', 'CoreDump: xstate services',
globalThis?.window?.__xstate__?.services globalThis?.window?.__xstate__?.services
) )