mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	main: Setup logging before wlc_init.
If `wlc_init` fails the error message will never be logged or printed anywhere.
This commit is contained in:
		
							parent
							
								
									01c5349e1a
								
							
						
					
					
						commit
						c26a4b42cf
					
				
					 1 changed files with 8 additions and 8 deletions
				
			
		
							
								
								
									
										16
									
								
								sway/main.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								sway/main.c
									
										
									
									
									
								
							| 
						 | 
					@ -107,6 +107,14 @@ int main(int argc, char **argv) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// we need to setup logging before wlc_init in case it fails.
 | 
				
			||||||
 | 
						if (debug) {
 | 
				
			||||||
 | 
							init_log(L_DEBUG);
 | 
				
			||||||
 | 
						} else if (verbose || validate) {
 | 
				
			||||||
 | 
							init_log(L_INFO);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							init_log(L_ERROR);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	setenv("WLC_DIM", "0", 0);
 | 
						setenv("WLC_DIM", "0", 0);
 | 
				
			||||||
	wlc_log_set_handler(wlc_log_handler);
 | 
						wlc_log_set_handler(wlc_log_handler);
 | 
				
			||||||
	detect_nvidia();
 | 
						detect_nvidia();
 | 
				
			||||||
| 
						 | 
					@ -119,14 +127,6 @@ int main(int argc, char **argv) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	register_extensions();
 | 
						register_extensions();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (debug) {
 | 
					 | 
				
			||||||
		init_log(L_DEBUG);
 | 
					 | 
				
			||||||
	} else if (verbose || validate) {
 | 
					 | 
				
			||||||
		init_log(L_INFO);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		init_log(L_ERROR);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
 | 
					#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
 | 
				
			||||||
	sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
 | 
						sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue