mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	daemon: allow for a -v, -vv, -vvv argument to increase verbosity
Sometimes that's faster than having to play with PIPEWIRE_DEBUG. Same for pipewire-media-session.
This commit is contained in:
		
							parent
							
								
									39fa2e503f
								
							
						
					
					
						commit
						69e935e8a4
					
				
					 3 changed files with 20 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -30,6 +30,10 @@ OPTIONS
 | 
			
		|||
-h | --help
 | 
			
		||||
  Show help.
 | 
			
		||||
 | 
			
		||||
-v | --verbose
 | 
			
		||||
  Increase the verbosity by one level. This option may be specified multiple
 | 
			
		||||
  times.
 | 
			
		||||
 | 
			
		||||
--version
 | 
			
		||||
  Show version information.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,12 +59,14 @@ int main(int argc, char *argv[])
 | 
			
		|||
		{ "help",	no_argument,		NULL, 'h' },
 | 
			
		||||
		{ "version",	no_argument,		NULL, 'V' },
 | 
			
		||||
		{ "config",	required_argument,	NULL, 'c' },
 | 
			
		||||
		{ "verbose",	no_argument,		NULL, 'v' },
 | 
			
		||||
 | 
			
		||||
		{ NULL, 0, NULL, 0}
 | 
			
		||||
	};
 | 
			
		||||
	int c, res = 0;
 | 
			
		||||
	char path[PATH_MAX];
 | 
			
		||||
	const char *config_name;
 | 
			
		||||
	enum spa_log_level level = pw_log_level;
 | 
			
		||||
 | 
			
		||||
	if (setenv("PIPEWIRE_INTERNAL", "1", 1) < 0)
 | 
			
		||||
		fprintf(stderr, "can't set PIPEWIRE_INTERNAL env: %m");
 | 
			
		||||
| 
						 | 
				
			
			@ -74,8 +76,12 @@ int main(int argc, char *argv[])
 | 
			
		|||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVc:", long_options, NULL)) != -1) {
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVc:v", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'v':
 | 
			
		||||
			if (level < SPA_LOG_LEVEL_TRACE)
 | 
			
		||||
				level++;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(argv[0], config_name);
 | 
			
		||||
			return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -95,6 +101,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			goto done;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	pw_log_set_level(level);
 | 
			
		||||
 | 
			
		||||
	properties = pw_properties_new(
 | 
			
		||||
				PW_KEY_CONFIG_NAME, config_name,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2442,15 +2442,21 @@ int main(int argc, char *argv[])
 | 
			
		|||
		{ "help",	no_argument,		NULL, 'h' },
 | 
			
		||||
		{ "version",	no_argument,		NULL, 'V' },
 | 
			
		||||
		{ "config",	required_argument,	NULL, 'c' },
 | 
			
		||||
		{ "verbose",	no_argument,		NULL, 'v' },
 | 
			
		||||
		{ NULL, 0, NULL, 0}
 | 
			
		||||
	};
 | 
			
		||||
        size_t i;
 | 
			
		||||
	const struct spa_dict_item *item;
 | 
			
		||||
	enum spa_log_level level = pw_log_level;
 | 
			
		||||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVc:", long_options, NULL)) != -1) {
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVc:v", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'v':
 | 
			
		||||
			if (level < SPA_LOG_LEVEL_TRACE)
 | 
			
		||||
				level++;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'h':
 | 
			
		||||
			do_show_help = true;
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -2469,6 +2475,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	pw_log_set_level(level);
 | 
			
		||||
 | 
			
		||||
	impl.this.props = pw_properties_new(
 | 
			
		||||
			PW_KEY_CONFIG_PREFIX, SESSION_PREFIX,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue