mirror of
https://github.com/tezc/sc.git
synced 2025-01-14 06:43:04 +08:00
if log level is "error", print log to stderr instead of stdout (#57)
This commit is contained in:
parent
ca520dd749
commit
f19158c3d9
@ -320,13 +320,14 @@ static int sc_log_print_header(FILE *fp, enum sc_log_level level)
|
||||
static int sc_log_stdout(enum sc_log_level level, const char *fmt, va_list va)
|
||||
{
|
||||
int rc;
|
||||
FILE *dest = level == SC_LOG_ERROR ? stderr : stdout;
|
||||
|
||||
rc = sc_log_print_header(stdout, level);
|
||||
rc = sc_log_print_header(dest, level);
|
||||
if (rc < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = vfprintf(stdout, fmt, va);
|
||||
rc = vfprintf(dest, fmt, va);
|
||||
if (rc < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user