91 inline static void log(
LogLevel level, std::string prefix, std::string color, fmt::format_string<Args...> format, Args&&... args)
93 if (Logger::logLevel < level)
96 TimePoint now = std::chrono::system_clock::now();
97 uint64_t ms = std::chrono::duration_cast<std::chrono::milliseconds>(
98 now.time_since_epoch())
103 if (sceRtcGetCurrentClockLocalTime)
104 sceRtcGetCurrentClockLocalTime(<);
106 std::time_t tt = std::chrono::system_clock::to_time_t(now);
109 std::unique_lock<std::mutex> lock;
110 if (Logger::threadSafeLogging)
111 lock = std::unique_lock { logMtx };
113 std::FILE* out = resolveLogOutput();
120 std::string
log = fmt::format(format, std::forward<Args>(args)...);
124 fmt::print(out,
"{:%H:%M:%S}.{:03d} {} {}\n", time_tm, (
int)ms, color,
log);
125#elif defined(ANDROID)
126 __android_log_print(6 - (
int)level,
"aurore",
"%02d:%02d:%02d.%03d %s\n", time_tm.tm_hour, time_tm.tm_min, time_tm.tm_sec, (
int)ms,
log.c_str());
127#elif defined(__PSV__)
128 sceClibPrintf(
"%02d:%02d:%02d.%03d\033%s[%s]\033[0m %s\n", time_tm.tm_hour, time_tm.tm_min, time_tm.tm_sec, (
int)ms, color.c_str(), prefix.c_str(),
log.c_str());
130 sceKernelDebugOutText(0, fmt::format(
"{:02d}:{:02d}:{:02d}.{:03d}\033{}[{}]\033[0m {}\n", lt.hour, lt.minute, lt.second, (
int)ms, color, prefix,
log).c_str());
133 fmt::print(out,
"{:%H:%M:%S}.{:03d}\033{}[{}]\033[0m {}\n", time_tm, (
int)ms, color, prefix,
log);
136 logEvent.
fire(now, level,
log);
138 catch (
const std::exception& e)
141 printf(
"! Invalid log format string: \"%s\": %s\n", format.get().data(), e.what());