@@ -26,18 +26,19 @@ bool ProcessDebugEngine(const std::string& cmd) {
2626#endif
2727 if (isInConsoleDebugMode) {
2828 EngineScope enter (debugEngine);
29+ auto & logger = lse::LegacyScriptEngine::getInstance ().getSelf ().getLogger ();
2930 try {
3031 if (cmd == " stop" || cmd == LLSE_DEBUG_CMD) {
3132 return true ;
3233 } else {
3334 auto result = debugEngine->eval (cmd);
3435 std::ostringstream sout;
3536 PrintValue (sout, result);
36- lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () .info (sout.str ());
37+ logger .info (sout.str ());
3738 std::cout << " > " << std::flush;
3839 }
3940 } catch (Exception& e) {
40- ll::error_utils::printException (e, lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () );
41+ ll::error_utils::printException (e, logger );
4142 std::cout << " > " << std::flush;
4243 }
4344 return false ;
@@ -54,6 +55,7 @@ void RegisterDebugCommand() {
5455 .getOrCreateCommand (LLSE_DEBUG_CMD, " Debug LegacyScriptEngine" , CommandPermissionLevel::Owner);
5556 command.overload <EngineDebugCommand>().optional (" eval" ).execute (
5657 [](CommandOrigin const &, CommandOutput& output, EngineDebugCommand const & param) {
58+ auto & logger = lse::LegacyScriptEngine::getInstance ().getSelf ().getLogger ();
5759 if (!param.eval .getText ().empty ()) {
5860 EngineScope enter (debugEngine);
5961 try {
@@ -62,16 +64,16 @@ void RegisterDebugCommand() {
6264 PrintValue (sout, result);
6365 output.success (sout.str ());
6466 } catch (Exception& e) {
65- ll::error_utils::printException (e, lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () );
67+ ll::error_utils::printException (e, logger );
6668 }
6769 } else {
6870 if (isInConsoleDebugMode) {
6971 // EndDebug
70- lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () .info (" Debug mode ended" );
72+ logger .info (" Debug mode ended" );
7173 isInConsoleDebugMode = false ;
7274 } else {
7375 // StartDebug
74- lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () .info (" Debug mode begins" );
76+ logger .info (" Debug mode begins" );
7577 isInConsoleDebugMode = true ;
7678 std::cout << " > " << std::flush;
7779 }
0 commit comments