update: refactor and rename
This commit is contained in:
46
src/log.c
46
src/log.c
@ -1,5 +1,4 @@
|
||||
#include "log.h"
|
||||
#include "env.h"
|
||||
#include "intl.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -54,18 +53,18 @@ bool bar(float cur, float max) {
|
||||
return true;
|
||||
lastprog = prog;
|
||||
|
||||
printf("\r" COLOR_BOLD "[");
|
||||
printf("\r" FG_BOLD "[");
|
||||
for (int i = 0; i < prog; i++) {
|
||||
printf("#");
|
||||
}
|
||||
printf(COLOR_BLUE "#" COLOR_RESET COLOR_BOLD);
|
||||
printf(FG_BLUE "#" FG_RESET FG_BOLD);
|
||||
|
||||
for (int i = prog; i < size; i++) {
|
||||
printf(" ");
|
||||
}
|
||||
printf("]" COLOR_RESET);
|
||||
printf("]" FG_RESET);
|
||||
|
||||
printf(COLOR_BOLD COLOR_BLUE "%s" COLOR_RESET "\r", perc);
|
||||
printf(FG_BOLD FG_BLUE "%s" FG_RESET "\r", perc);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,9 +72,9 @@ void info(const char *msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
printf(COLOR_BOLD COLOR_BLUE ">>> " COLOR_RESET COLOR_BOLD);
|
||||
printf(FG_BOLD FG_BLUE ">>> " FG_RESET);
|
||||
vprintf(msg, args);
|
||||
printf(COLOR_RESET "\n");
|
||||
printf(FG_RESET "\n");
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
@ -84,9 +83,9 @@ void error(const char *msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
printf(COLOR_BOLD COLOR_RED ">>> " COLOR_RESET COLOR_BOLD);
|
||||
printf(FG_BOLD FG_RED ">>> " FG_RESET);
|
||||
vprintf(msg, args);
|
||||
printf(COLOR_RESET "\n");
|
||||
printf(FG_RESET "\n");
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
@ -95,9 +94,9 @@ void details(const char *msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
printf(" " COLOR_RESET);
|
||||
printf(" " FG_RESET);
|
||||
vprintf(msg, args);
|
||||
printf(COLOR_RESET "\n");
|
||||
printf(FG_RESET "\n");
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
@ -106,23 +105,9 @@ void success(const char *msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
printf(COLOR_BOLD COLOR_GREEN ">>> " COLOR_RESET COLOR_BOLD);
|
||||
printf(FG_BOLD FG_GREEN ">>> " FG_RESET);
|
||||
vprintf(msg, args);
|
||||
printf(COLOR_RESET "\n");
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void debug(const char *msg, ...) {
|
||||
if (!env_mc_debug())
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
printf(COLOR_BOLD COLOR_MAGENTA "DEBUG: " COLOR_RESET COLOR_BOLD);
|
||||
vprintf(msg, args);
|
||||
printf(COLOR_RESET "\n");
|
||||
printf(FG_RESET "\n");
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
@ -131,17 +116,14 @@ void input(const char *msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
printf(COLOR_BOLD COLOR_CYAN ">>> " COLOR_RESET COLOR_BOLD);
|
||||
printf(FG_BOLD FG_CYAN ">>> " FG_RESET);
|
||||
vprintf(msg, args);
|
||||
printf(COLOR_RESET);
|
||||
printf(FG_RESET);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
bool yesno(const char *msg) {
|
||||
if (env_mc_yes())
|
||||
return true;
|
||||
|
||||
char *yes[] = {_("y"), _("Y")};
|
||||
char *no[] = {_("n"), _("N")};
|
||||
|
||||
|
Reference in New Issue
Block a user