Skip to content

Commit 6ead937

Browse files
committed
fix: fix default logger title
1 parent 2a7500f commit 6ead937

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/legacy/api/LoggerAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Local<Value> LoggerClass::setTitle(const Arguments& args) {
127127
CHECK_ARG_TYPE(args[0], ValueKind::kString)
128128

129129
getEngineOwnData()->logger = ll::io::LoggerRegistry::getInstance().getOrCreate(args[0].asString().toString());
130-
return Boolean::newBoolean(false);
130+
return Boolean::newBoolean(true);
131131
}
132132

133133
///////////////// Helper /////////////////

src/legacy/api/ScriptAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Local<Value> Log(const Arguments& args) {
2424
std::ostringstream sout;
2525
for (int i = 0; i < args.size(); ++i) PrintValue(sout, args[i]);
2626
sout << std::endl;
27-
getEngineOwnData()->plugin->getLogger().info(sout.str());
27+
getEngineOwnData()->logger->info(sout.str());
2828
return Boolean::newBoolean(true);
2929
}
3030
CATCH("Fail in Log!");

src/legacy/engine/EngineOwnData.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ struct SimpleCallbackData
3838
// It is similar to ll::mod::Mod, it stores data of an engine(usually a plugin).
3939
struct EngineOwnData {
4040
// 基础信息
41-
std::string pluginName = "";
42-
std::string pluginFileOrDirPath = "";
41+
std::string pluginName = {};
42+
std::string pluginFileOrDirPath = {};
4343
std::string engineType = LLSE_BACKEND_TYPE;
4444

4545
// 表单回调
@@ -75,7 +75,7 @@ struct EngineOwnData {
7575
std::string defaultLocaleName;
7676

7777
std::shared_ptr<lse::Plugin> plugin;
78-
std::shared_ptr<ll::io::Logger> logger = ll::io::LoggerRegistry::getInstance().getOrCreate(pluginName);
78+
std::shared_ptr<ll::io::Logger> logger;
7979

8080
// 玩家绑定数据
8181
std::unordered_map<std::string, script::Global<Value>> playerDataDB;

src/lse/PluginManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ ll::Expected<> PluginManager::load(ll::mod::Manifest manifest) {
135135
try {
136136
script::EngineScope engineScope(scriptEngine);
137137

138-
// Set plugins's logger title
139-
getEngineOwnData()->pluginName = manifest.name;
138+
// Init plugin logger
139+
getEngineOwnData()->logger = ll::io::LoggerRegistry::getInstance().getOrCreate(manifest.name);
140140

141141
#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON
142142
scriptEngine.eval("import sys as _llse_py_sys_module");

0 commit comments

Comments
 (0)