Skip to content

Commit ef28256

Browse files
committed
change stdoutput
1 parent 8ebfbcb commit ef28256

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/cli/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ void sd_log_cb(enum sd_log_level_t level, const char* log, void* data) {
460460
return;
461461
}
462462
if (level <= SD_LOG_INFO) {
463-
fputs(log, stdout);
464-
fflush(stdout);
463+
fputs(log, stderr);
464+
fflush(stderr);
465465
} else {
466466
fputs(log, stderr);
467467
fflush(stderr);
@@ -597,7 +597,7 @@ int main(int argc, const char* argv[]) {
597597
std::string final_image_path = i > 0 ? dummy_name + "_" + std::to_string(i + 1) + ".png" : dummy_name + ".png";
598598
stbi_write_png(final_image_path.c_str(), results[i].width, results[i].height, results[i].channel,
599599
results[i].data, 0, get_image_params(params, params.seed + i).c_str());
600-
printf("save result image to '%s'\n", final_image_path.c_str());
600+
fprintf(stderr, "save result image to '%s'\n", final_image_path.c_str());
601601
free(results[i].data);
602602
results[i].data = NULL;
603603
}

util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ void pretty_progress(int step, int steps, float time) {
183183
}
184184
}
185185
progress += "|";
186-
printf(time > 1.0f ? "\r%s %i/%i - %.2fs/it" : "\r%s %i/%i - %.2fit/s",
186+
fprintf(stderr, time > 1.0f ? "\r%s %i/%i - %.2fs/it" : "\r%s %i/%i - %.2fit/s",
187187
progress.c_str(), step, steps,
188188
time > 1.0f || time == 0 ? time : (1.0f / time));
189189
fflush(stderr); // for linux
190190
if (step == steps) {
191-
printf("\n");
191+
fprintf(stderr, "\n");
192192
}
193193
fprintf(stdout, "{'step' : '%i', 'steps': '%i', 'time': '%.2f'}\n", step, steps, time);
194194
fflush(stdout); // for linux

0 commit comments

Comments
 (0)