diff --git a/frontend/src/components/widgets/inputs/MenuBarInput.vue b/frontend/src/components/widgets/inputs/MenuBarInput.vue index 40558693..3b7f1142 100644 --- a/frontend/src/components/widgets/inputs/MenuBarInput.vue +++ b/frontend/src/components/widgets/inputs/MenuBarInput.vue @@ -170,7 +170,21 @@ function makeMenuEntries(editor: EditorState): MenuListEntries { { label: "Report a Bug", action: (): unknown => window.open("https://github.com/GraphiteEditor/Graphite/issues/new", "_blank") }, { label: "Visit on GitHub", action: (): unknown => window.open("https://github.com/GraphiteEditor/Graphite", "_blank") }, ], - [{ label: "Debug: Panic (DANGER)", action: async (): Promise => editor.rawWasm.intentional_panic() }], + [ + { + label: "Debug: Set Log Level", + // TODO: Remove empty action after merge of (https://github.com/GraphiteEditor/Graphite/pull/338) + action: (): void => undefined, + children: [ + [ + { label: "Log Level Info", action: async (): Promise => editor.instance.log_level_info(), shortcut: ["Key1"] }, + { label: "Log Level Debug", action: async (): Promise => editor.instance.log_level_debug(), shortcut: ["Key2"] }, + { label: "Log Level Trace", action: async (): Promise => editor.instance.log_level_trace(), shortcut: ["Key3"] }, + ], + ], + }, + { label: "Debug: Panic (DANGER)", action: async (): Promise => editor.rawWasm.intentional_panic() }, + ], ], }, ]; diff --git a/frontend/wasm/src/api.rs b/frontend/wasm/src/api.rs index ebc520c0..ac586a62 100644 --- a/frontend/wasm/src/api.rs +++ b/frontend/wasm/src/api.rs @@ -220,6 +220,21 @@ impl JsEditorHandle { self.dispatch(message); } + pub fn log_level_info(&self) { + let message = GlobalMessage::LogInfo; + self.dispatch(message); + } + + pub fn log_level_debug(&self) { + let message = GlobalMessage::LogDebug; + self.dispatch(message); + } + + pub fn log_level_trace(&self) { + let message = GlobalMessage::LogTrace; + self.dispatch(message); + } + /// Send new bounds when document panel viewports get resized or moved within the editor /// [left, top, right, bottom]... pub fn bounds_of_viewports(&self, bounds_of_viewports: &[f64]) {