Skip to content

Commit fb92109

Browse files
committed
chore: remove some macros
1 parent 7d9a593 commit fb92109

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/legacy/main/BuiltinCommands.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -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
}

src/legacy/main/PythonHelper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ std::string getPluginPackDependencyFilePath(const std::string& dirPath) {
142142
else return "";
143143
}
144144

145-
#define OUTPUT_DEBUG_SIGN() std::cout << ">>> " << std::flush
146-
#define OUTPUT_DEBUG_NEED_MORE_CODE_SIGN() std::cout << "... " << std::flush
145+
inline void OUTPUT_DEBUG_SIGN() { std::cout << ">>> " << std::flush; }
146+
inline void OUTPUT_DEBUG_NEED_MORE_CODE_SIGN() { std::cout << "... " << std::flush; }
147147
std::string codeBuffer = "";
148148
bool isInsideCodeBlock = false;
149149

0 commit comments

Comments
 (0)