Skip to content

Commit

Permalink
fix: fix debug engine's logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jan 29, 2025
1 parent d6b589c commit 1badab5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lse/Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,28 @@ void loadConfig(const ll::mod::NativeMod& self, Config& cfg) {

void loadDebugEngine(const ll::mod::NativeMod& self) {
#ifndef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS // NodeJs backend didn't enable debug engine now
auto& scriptEngine = *EngineManager::newEngine();
auto scriptEngine = EngineManager::newEngine();

script::EngineScope engineScope(scriptEngine);

// Init plugin instance for debug engine to prevent something unexpected.
ll::mod::Manifest manifest;
manifest.name = "DebugEngine";
getEngineOwnData()->plugin = std::make_shared<lse::Plugin>(manifest);
// Init logger
getEngineOwnData()->logger = ll::io::LoggerRegistry::getInstance().getOrCreate("DebugEngine");

BindAPIs(&scriptEngine);
BindAPIs(scriptEngine);

// Load BaseLib.
auto baseLibPath = self.getModDir() / "baselib" / BaseLibFileName;
auto baseLibContent = ll::file_utils::readFile(baseLibPath);
if (!baseLibContent) {
throw std::runtime_error("Failed to read BaseLib at {0}"_tr(baseLibPath.string()));
}
scriptEngine.eval(baseLibContent.value());
scriptEngine->eval(baseLibContent.value());

debugEngine = &scriptEngine;
debugEngine = scriptEngine;
#endif
}

Expand Down

0 comments on commit 1badab5

Please sign in to comment.