diff options
| author | Drew DeVault <sir@cmpwn.com> | 2018-09-03 11:15:12 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-03 11:15:12 -0400 | 
| commit | 73423c988c864167447cd4292bacd3a248ef07f8 (patch) | |
| tree | a26a1ab7dd1fea32d39517ec2fbcda30a3138a29 /rootston | |
| parent | d31a267f36aa23d6ac40709226c0d4a939cf00b4 (diff) | |
| parent | 6daa69fbf567f8036031867d6767158a0a6e5fe4 (diff) | |
| download | wlroots-73423c988c864167447cd4292bacd3a248ef07f8.tar.xz | |
Merge pull request #1213 from arandomhuman/wlr_log_get_verbosity
Add wlr_log_get_verbosity method
Diffstat (limited to 'rootston')
| -rw-r--r-- | rootston/config.c | 15 | 
1 files changed, 13 insertions, 2 deletions
| diff --git a/rootston/config.c b/rootston/config.c index 0c0ad055..92d90de1 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -26,7 +26,10 @@ static void usage(const char *name, int ret) {  		"                See `rootston.ini.example` for config\n"  		"                file documentation.\n"  		" -E <COMMAND>   Command that will be ran at startup.\n" -		" -D             Enable damage tracking debugging.\n", +		" -D             Enable damage tracking debugging.\n" +		" -l <LEVEL>     Set log verbosity, where,\n" +		"                0:SILENT, 1:ERROR, 2:INFO, 3+:DEBUG\n" +		"                (default: DEBUG)\n",  		name);  	exit(ret); @@ -455,7 +458,8 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) {  	wl_list_init(&config->bindings);  	int c; -	while ((c = getopt(argc, argv, "C:E:hD")) != -1) { +	unsigned int log_verbosity = WLR_DEBUG; +	while ((c = getopt(argc, argv, "C:E:hDl:")) != -1) {  		switch (c) {  		case 'C':  			config->config_path = strdup(optarg); @@ -466,11 +470,18 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) {  		case 'D':  			config->debug_damage_tracking = true;  			break; +		case 'l': +			log_verbosity = strtoul(optarg, NULL, 10); +			if (log_verbosity >= WLR_LOG_IMPORTANCE_LAST) { +				log_verbosity = WLR_LOG_IMPORTANCE_LAST - 1; +			} +			break;  		case 'h':  		case '?':  			usage(argv[0], c != 'h');  		}  	} +	wlr_log_init(log_verbosity, NULL);  	if (!config->config_path) {  		// get the config path from the current directory | 
