conf: add --silent
Suppress debug, info, notice and warning messages if --silent is given. This is overwritten by --debug and --verbose. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
929860217f
commit
e35ca87a95
@ -51,6 +51,7 @@ static void print_help()
|
||||
"\t-h, --help Print this help and exit\n"
|
||||
"\t-v, --verbose Print verbose messages\n"
|
||||
"\t --debug Enable debug mode\n"
|
||||
"\t --silent Suppress notices and warnings\n"
|
||||
"\t-s, --switchvt Automatically switch to VT\n",
|
||||
"kmscon");
|
||||
}
|
||||
@ -63,6 +64,7 @@ int conf_parse_argv(int argc, char **argv)
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "verbose", no_argument, NULL, 'v' },
|
||||
{ "debug", no_argument, &conf_global.debug, 1 },
|
||||
{ "silent", no_argument, &conf_global.silent, 1 },
|
||||
{ "switchvt", no_argument, NULL, 's' },
|
||||
{ NULL, 0, NULL, 0 },
|
||||
};
|
||||
|
@ -49,6 +49,8 @@ struct conf_obj {
|
||||
int debug;
|
||||
/* enable verbose info messages */
|
||||
int verbose;
|
||||
/* disable notices and warnings */
|
||||
int silent;
|
||||
/* enter new VT directly */
|
||||
int switchvt;
|
||||
};
|
||||
|
@ -133,6 +133,8 @@ struct log_config {
|
||||
LOG_CONFIG_ALL((debug), 2, 2, 2, 2, 2, 2)
|
||||
#define LOG_CONFIG_INFO(debug, info) \
|
||||
LOG_CONFIG_ALL((debug), (info), 2, 2, 2, 2, 2)
|
||||
#define LOG_CONFIG_WARNING(debug, info, notice, warning) \
|
||||
LOG_CONFIG_ALL((debug), (info), (notice), (warning), 2, 2, 2)
|
||||
|
||||
void log_set_config(const struct log_config *config);
|
||||
int log_add_filter(const struct log_filter *filter,
|
||||
|
@ -142,9 +142,13 @@ int main(int argc, char **argv)
|
||||
if (conf_global.exit)
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
if (!conf_global.debug && !conf_global.verbose && conf_global.silent)
|
||||
log_set_config(&LOG_CONFIG_WARNING(0, 0, 0, 0));
|
||||
else
|
||||
log_set_config(&LOG_CONFIG_INFO(conf_global.debug,
|
||||
conf_global.verbose));
|
||||
|
||||
log_print_init("kmscon");
|
||||
log_set_config(&LOG_CONFIG_INFO(conf_global.debug,
|
||||
conf_global.verbose));
|
||||
|
||||
memset(&app, 0, sizeof(app));
|
||||
ret = setup_app(&app);
|
||||
|
Loading…
x
Reference in New Issue
Block a user