tweak sd logging, show progress normally

This commit is contained in:
Concedo 2024-03-10 11:45:11 +08:00
parent c08d7e5042
commit 6990d07a26
3 changed files with 10 additions and 10 deletions

View file

@ -207,12 +207,12 @@ std::string path_join(const std::string& p1, const std::string& p2) {
return p1 + "/" + p2;
}
static bool do_log = true;
static int sdloglevel = 0; //-1 = hide all, 0 = normal, 1 = showall
void pretty_progress(int step, int steps, float time) {
if (step == 0) {
return;
}
if(!do_log)
if(sdloglevel<0)
{
return;
}
@ -262,7 +262,7 @@ void* sd_log_cb_data = NULL;
#define LOG_BUFFER_SIZE 1024
void log_message(const char* format, ...) {
if (do_log) {
if (sdloglevel>0) {
printf("\n");
va_list args;
va_start(args, format);
@ -271,13 +271,13 @@ void log_message(const char* format, ...) {
fflush(stdout);
}
}
void set_log_message(bool log)
void set_sd_log_level(int log)
{
do_log = log;
sdloglevel = log;
}
bool get_log_message()
bool get_sd_log_level()
{
return do_log;
return sdloglevel;
}
void log_printf(sd_log_level_t level, const char* file, int line, const char* format, ...) {