mirror of
https://github.com/open-goal/jak-project
synced 2026-08-14 20:43:54 -04:00
Change important printfs to lg::print (#3355)
This allows them to be logged into a file, useful for debugging. With this, GOAL `format` and C-kernel `Msg` (and its variants) will be logged.
This commit is contained in:
@@ -112,8 +112,31 @@ void log_print(const char* message) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void log_vprintf(const char* format, va_list arg_list) {
|
||||
{
|
||||
// We always immediately flush prints because since it has no associated level
|
||||
// it could be anything from a fatal error to a useless debug log.
|
||||
std::lock_guard<std::mutex> lock(gLogger.mutex);
|
||||
if (gLogger.fp) {
|
||||
// Log to File
|
||||
vfprintf(gLogger.fp, format, arg_list);
|
||||
fflush(gLogger.fp);
|
||||
}
|
||||
|
||||
if (gLogger.stdout_log_level < lg::level::off_unless_die) {
|
||||
vprintf(format, arg_list);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
void printstd(const std::string& format, va_list arg_list) {
|
||||
internal::log_vprintf(format.c_str(), arg_list);
|
||||
}
|
||||
|
||||
// how many extra log files for a single program should be kept?
|
||||
constexpr int LOG_ROTATE_MAX = 10;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user