mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-07 14:06:00 +01:00
Add support for setting log verbosity in rootston
This commit is contained in:
parent
93382dc445
commit
cdf41fa627
1 changed files with 13 additions and 2 deletions
|
@ -26,7 +26,10 @@ static void usage(const char *name, int ret) {
|
||||||
" See `rootston.ini.example` for config\n"
|
" See `rootston.ini.example` for config\n"
|
||||||
" file documentation.\n"
|
" file documentation.\n"
|
||||||
" -E <COMMAND> Command that will be ran at startup.\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);
|
name);
|
||||||
|
|
||||||
exit(ret);
|
exit(ret);
|
||||||
|
@ -455,7 +458,8 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) {
|
||||||
wl_list_init(&config->bindings);
|
wl_list_init(&config->bindings);
|
||||||
|
|
||||||
int c;
|
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) {
|
switch (c) {
|
||||||
case 'C':
|
case 'C':
|
||||||
config->config_path = strdup(optarg);
|
config->config_path = strdup(optarg);
|
||||||
|
@ -466,11 +470,18 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) {
|
||||||
case 'D':
|
case 'D':
|
||||||
config->debug_damage_tracking = true;
|
config->debug_damage_tracking = true;
|
||||||
break;
|
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 'h':
|
||||||
case '?':
|
case '?':
|
||||||
usage(argv[0], c != 'h');
|
usage(argv[0], c != 'h');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wlr_log_init(log_verbosity, NULL);
|
||||||
|
|
||||||
if (!config->config_path) {
|
if (!config->config_path) {
|
||||||
// get the config path from the current directory
|
// get the config path from the current directory
|
||||||
|
|
Loading…
Reference in a new issue