Add get_log_level() to encapsulate v (current log level)

This patch also makes all global variable in log.c static.
This commit is contained in:
David Eklov 2016-06-27 02:29:37 -05:00
parent a32f4adec4
commit 40d67b13d9
3 changed files with 9 additions and 6 deletions

View file

@ -10,9 +10,9 @@
#include <signal.h>
#include <stringop.h>
int colored = 1;
log_importance_t loglevel_default = L_ERROR;
log_importance_t v = L_SILENT;
static int colored = 1;
static log_importance_t loglevel_default = L_ERROR;
static log_importance_t v = L_SILENT;
static const char *verbosity_colors[] = {
[L_SILENT] = "",
@ -36,6 +36,10 @@ void set_log_level(log_importance_t verbosity) {
v = verbosity;
}
log_importance_t get_log_level(void) {
return v;
}
void reset_log_level(void) {
v = loglevel_default;
}