MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / LogImpl

Function LogImpl

Goldleaf/source/base.cpp:325–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325void LogImpl(const char *log_buf, const size_t log_buf_len) {
326 ScopedLock lk(g_LogLock);
327
328 const auto thread_name = GetThreadName();
329 std::string cur_time = "...";
330 if(g_Settings.json_settings.general.has_value() && g_Settings.json_settings.general.value().use_12h_time.has_value()) {
331 cur_time = hos::GetCurrentTime(g_Settings.json_settings.general.value().use_12h_time.value());
332 }
333 const auto log_str = "[" + cur_time + "] [" + thread_name + "] " + std::string(log_buf, log_buf_len);
334
335 // To ensure no race conditions, use plain FS functions instead of the explorers
336 auto log_file = fopen("sdmc:/" GLEAF_PATH_LOG_FILE, "a+");
337 if(log_file != nullptr) {
338 fwrite(log_str.c_str(), 1, log_str.length(), log_file);
339 fclose(log_file);
340 }
341}

Callers

nothing calls this directly

Calls 2

GetThreadNameFunction · 0.85
GetCurrentTimeFunction · 0.85

Tested by

no test coverage detected