write error messages using log_error

This commit is contained in:
onyx-and-iris 2024-06-27 08:27:49 +01:00
parent 41afc099dc
commit 6567c2c610

View File

@ -69,10 +69,9 @@ int main(int argc, char *argv[])
} }
else else
{ {
fputs( log_error(
"-D arg out of range, expected value from 0 up to 5\n" "-D arg out of range, expected value from 0 up to 5\n"
"Log level will default to LOG_WARN (3).\n", "Log level will default to LOG_WARN (3).\n");
stderr);
} }
break; break;
default: default:
@ -138,7 +137,7 @@ int set_kind(char *kval)
} }
else else
{ {
fprintf(stderr, "Unknown Voicemeeter kind '%s'\n", kval); log_error("Unknown Voicemeeter kind '%s'\n", kval);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -150,11 +149,11 @@ int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind)
{ {
if (rep == -100) if (rep == -100)
{ {
fputs("Voicemeeter is not installed", stderr); log_error("Voicemeeter is not installed");
} }
else else
{ {
fprintf(stderr, "Error loading Voicemeeter dll with code %d\n", rep); log_error("Error loading Voicemeeter dll with code %d\n", rep);
} }
return rep; return rep;
} }
@ -162,7 +161,7 @@ int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind)
rep = login(vmr, kind); rep = login(vmr, kind);
if (rep != 0) if (rep != 0)
{ {
fputs("Error logging into Voicemeeter", stderr); log_error("Error logging into Voicemeeter");
return rep; return rep;
} }
@ -232,7 +231,7 @@ void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
puts(res.val.s); puts(res.val.s);
break; break;
default: default:
fputs("Unexpected result type", stderr); log_error("Unexpected result type");
break; break;
} }
} }
@ -247,7 +246,7 @@ struct result *get(T_VBVMR_INTERFACE *vmr, char *command, struct result *res)
if (get_parameter_string(vmr, command, res->val.s) != 0) if (get_parameter_string(vmr, command, res->val.s) != 0)
{ {
res->val.s[0] = 0; res->val.s[0] = 0;
fputs("Unknown parameter", stderr); log_error("Unknown parameter");
} }
} }