Download editor/src/messages/debug/debug_message_handler.rs from openfree/graphite2: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/openfree/graphite2/resolve/main/editor/src/messages/debug/debug_message_handler.rs
- Command line
-
hf download hf://spaces/openfree/graphite2/editor/src/messages/debug/debug_message_handler.rs
-
curl -L -o debug_message_handler.rs https://huggingface.co/spaces/openfree/graphite2/resolve/main/editor/src/messages/debug/debug_message_handler.rs
1.49 kB
| use super::utility_types::MessageLoggingVerbosity; | |
| use crate::messages::prelude::*; | |
| pub struct DebugMessageHandler { | |
| pub message_logging_verbosity: MessageLoggingVerbosity, | |
| } | |
| impl MessageHandler<DebugMessage, ()> for DebugMessageHandler { | |
| fn process_message(&mut self, message: DebugMessage, responses: &mut VecDeque<Message>, _data: ()) { | |
| match message { | |
| DebugMessage::ToggleTraceLogs => { | |
| if log::max_level() == log::LevelFilter::Debug { | |
| log::set_max_level(log::LevelFilter::Trace); | |
| } else { | |
| log::set_max_level(log::LevelFilter::Debug); | |
| } | |
| // Refresh the checkmark beside the menu entry for this | |
| responses.add(MenuBarMessage::SendLayout); | |
| } | |
| DebugMessage::MessageOff => { | |
| self.message_logging_verbosity = MessageLoggingVerbosity::Off; | |
| // Refresh the checkmark beside the menu entry for this | |
| responses.add(MenuBarMessage::SendLayout); | |
| } | |
| DebugMessage::MessageNames => { | |
| self.message_logging_verbosity = MessageLoggingVerbosity::Names; | |
| // Refresh the checkmark beside the menu entry for this | |
| responses.add(MenuBarMessage::SendLayout); | |
| } | |
| DebugMessage::MessageContents => { | |
| self.message_logging_verbosity = MessageLoggingVerbosity::Contents; | |
| // Refresh the checkmark beside the menu entry for this | |
| responses.add(MenuBarMessage::SendLayout); | |
| } | |
| } | |
| } | |
| advertise_actions!(DebugMessageDiscriminant; | |
| ToggleTraceLogs, | |
| MessageOff, | |
| MessageNames, | |
| MessageContents, | |
| ); | |
| } | |