Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit d81c801

Browse files
authored
fix: print all logs to terminal with --verbose (#1228)
1 parent 554bb84 commit d81c801

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

engine/main.cc

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -200,21 +200,29 @@ int main(int argc, char* argv[]) {
200200
RunServer();
201201
return 0;
202202
} else {
203-
auto config = file_manager_utils::GetCortexConfig();
204-
std::filesystem::create_directories(
205-
std::filesystem::path(config.logFolderPath) /
206-
std::filesystem::path(cortex_utils::logs_folder));
207-
trantor::FileLogger asyncFileLogger;
208-
asyncFileLogger.setFileName(config.logFolderPath + "/" +
209-
cortex_utils::logs_cli_base_name);
210-
asyncFileLogger.setMaxLines(
211-
config.maxLogLines); // Keep last 100000 lines
212-
asyncFileLogger.startLogging();
213-
trantor::Logger::setOutputFunction(
214-
[&](const char* msg, const uint64_t len) {
215-
asyncFileLogger.output_(msg, len);
216-
},
217-
[&]() { asyncFileLogger.flush(); });
203+
bool verbose = false;
204+
for (int i = 0; i < argc; i++) {
205+
if (strcmp(argv[i], "--verbose") == 0) {
206+
verbose = true;
207+
}
208+
}
209+
if (!verbose) {
210+
auto config = file_manager_utils::GetCortexConfig();
211+
std::filesystem::create_directories(
212+
std::filesystem::path(config.logFolderPath) /
213+
std::filesystem::path(cortex_utils::logs_folder));
214+
trantor::FileLogger asyncFileLogger;
215+
asyncFileLogger.setFileName(config.logFolderPath + "/" +
216+
cortex_utils::logs_cli_base_name);
217+
asyncFileLogger.setMaxLines(
218+
config.maxLogLines); // Keep last 100000 lines
219+
asyncFileLogger.startLogging();
220+
trantor::Logger::setOutputFunction(
221+
[&](const char* msg, const uint64_t len) {
222+
asyncFileLogger.output_(msg, len);
223+
},
224+
[&]() { asyncFileLogger.flush(); });
225+
}
218226
CommandLineParser clp;
219227
clp.SetupCommand(argc, argv);
220228
return 0;

0 commit comments

Comments
 (0)