mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	log: add log level option
This commit is contained in:
		
							parent
							
								
									3f5c75c52d
								
							
						
					
					
						commit
						4c2b6c7c91
					
				
					 2 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -163,6 +163,7 @@ static inline void spa_log_trace_fp (struct spa_log *l, const char *format, ...)
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
/** keys can be given when initializing the logger handle */
 | 
			
		||||
#define SPA_KEY_LOG_LEVEL		"log.level"		/**< the default log level */
 | 
			
		||||
#define SPA_KEY_LOG_COLORS		"log.colors"		/**< enable colors in the logger */
 | 
			
		||||
#define SPA_KEY_LOG_FILE		"log.file"		/**< log to the specified file instead of
 | 
			
		||||
								  *  stderr. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -228,6 +228,8 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
	if (info) {
 | 
			
		||||
		if ((str = spa_dict_lookup(info, SPA_KEY_LOG_COLORS)) != NULL)
 | 
			
		||||
			this->colors = (strcmp(str, "true") == 0 || atoi(str) == 1);
 | 
			
		||||
		if ((str = spa_dict_lookup(info, SPA_KEY_LOG_LEVEL)) != NULL)
 | 
			
		||||
			this->log.level = atoi(str);
 | 
			
		||||
		if ((str = spa_dict_lookup(info, SPA_KEY_LOG_FILE)) != NULL) {
 | 
			
		||||
			this->file = fopen(str, "w");
 | 
			
		||||
			if (this->file == NULL)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue