@@ -26,18 +26,19 @@ bool ProcessDebugEngine(const std::string& cmd) {
26
26
#endif
27
27
if (isInConsoleDebugMode) {
28
28
EngineScope enter (debugEngine);
29
+ auto & logger = lse::LegacyScriptEngine::getInstance ().getSelf ().getLogger ();
29
30
try {
30
31
if (cmd == " stop" || cmd == LLSE_DEBUG_CMD) {
31
32
return true ;
32
33
} else {
33
34
auto result = debugEngine->eval (cmd);
34
35
std::ostringstream sout;
35
36
PrintValue (sout, result);
36
- lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () .info (sout.str ());
37
+ logger .info (sout.str ());
37
38
std::cout << " > " << std::flush;
38
39
}
39
40
} catch (Exception& e) {
40
- ll::error_utils::printException (e, lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () );
41
+ ll::error_utils::printException (e, logger );
41
42
std::cout << " > " << std::flush;
42
43
}
43
44
return false ;
@@ -54,6 +55,7 @@ void RegisterDebugCommand() {
54
55
.getOrCreateCommand (LLSE_DEBUG_CMD, " Debug LegacyScriptEngine" , CommandPermissionLevel::Owner);
55
56
command.overload <EngineDebugCommand>().optional (" eval" ).execute (
56
57
[](CommandOrigin const &, CommandOutput& output, EngineDebugCommand const & param) {
58
+ auto & logger = lse::LegacyScriptEngine::getInstance ().getSelf ().getLogger ();
57
59
if (!param.eval .getText ().empty ()) {
58
60
EngineScope enter (debugEngine);
59
61
try {
@@ -62,16 +64,16 @@ void RegisterDebugCommand() {
62
64
PrintValue (sout, result);
63
65
output.success (sout.str ());
64
66
} catch (Exception& e) {
65
- ll::error_utils::printException (e, lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () );
67
+ ll::error_utils::printException (e, logger );
66
68
}
67
69
} else {
68
70
if (isInConsoleDebugMode) {
69
71
// EndDebug
70
- lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () .info (" Debug mode ended" );
72
+ logger .info (" Debug mode ended" );
71
73
isInConsoleDebugMode = false ;
72
74
} else {
73
75
// StartDebug
74
- lse::LegacyScriptEngine::getInstance (). getSelf (). getLogger () .info (" Debug mode begins" );
76
+ logger .info (" Debug mode begins" );
75
77
isInConsoleDebugMode = true ;
76
78
std::cout << " > " << std::flush;
77
79
}
0 commit comments