Rename debug to info (logging)

This commit is contained in:
Wilson Lin 2018-07-06 17:03:26 +12:00
parent cd306005bb
commit a67257d740
2 changed files with 9 additions and 19 deletions

View File

@ -45,14 +45,8 @@ void hbe_fatal_set_autodelete(char *path) {
hbe_fatal_autodelete_file = path;
}
void hbe_debug(char *fmt, ...) {
va_list args;
va_start(args, fmt);
fprintf(stderr, PC_CYN "[DEBUG] " PC_RESET);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
}
void hbe_info(char *fmt, ...) {
fprintf(stderr, PC_MAG "[INFO] " PC_RESET);
void hbe_info_kv_boolean(char *name, int state) {
const char *color = state ? (PC_BOLD PC_GRN) : PC_MAG;
const char *label = state ? "ON" : "OFF";
@ -67,7 +61,7 @@ void hbe_info_kv_string(char *name, char *value) {
void hbe_warn(char *fmt, ...) {
va_list args;
va_start(args, fmt);
fprintf(stderr, PC_YEL "[WARN] " PC_RESET);
fprintf(stderr, PC_BOLD PC_YEL "[WARN] " PC_RESET);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
@ -85,7 +79,7 @@ void hbe_fatal(hbe_errcode_t errcode, char *fmt, ...) {
if (unlink(hbe_fatal_autodelete_file)) {
hbe_warn("Failed to delete file %s with error %d", hbe_fatal_autodelete_file, errno);
} else {
hbe_debug("%s has been deleted", hbe_fatal_autodelete_file);
hbe_info("%s has been deleted", _hbe_fatal_autodelete_file);
}
}

View File

@ -59,14 +59,10 @@ int main(int argc, char **argv) {
}
}
hbe_debug("Input: %s", input_path);
hbe_debug("Output: %s", output_path);
if (config_buffer) {
hbe_debug("Buffer: %d", config_buffer);
}
if (config_keep) {
hbe_debug("Keep: %d", config_keep);
}
hbe_info_kv_string("Input", input_path);
hbe_info_kv_string("Output", output_path);
hbe_info_kv_boolean("Buffer output until success", config_buffer);
hbe_info_kv_boolean("Keep output file on error", config_keep);
hbu_pipe_t pipe = hbu_pipe_create_blank();
@ -99,6 +95,6 @@ int main(int argc, char **argv) {
hbu_fstreamout_write_buffer(output, output_buffer);
}
hbe_debug("All done!");
hbe_info("All done!");
exit(EXIT_SUCCESS);
}