Get rid of a logging helper
This commit is contained in:
		
							parent
							
								
									381b34f731
								
							
						
					
					
						commit
						d2006d5a4e
					
				| 
						 | 
				
			
			@ -25,7 +25,7 @@ static void fclose_and_log(FILE* file) {
 | 
			
		|||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    std::system_error e = std::system_error(errno, std::generic_category(), "fclose()");
 | 
			
		||||
    log("Failed to close a file", std::move(e));
 | 
			
		||||
    log(std::string("Failed to close a file: ") + e.what());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool write(const std::string& ptr, FILE* file) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ static inline void write_config_and_update_structures(const Config& config) {
 | 
			
		|||
    try {
 | 
			
		||||
        write_config(config);
 | 
			
		||||
    } catch (const std::exception& e) {
 | 
			
		||||
        log("Failed to write config", e);
 | 
			
		||||
        log(std::string("Failed to write config: ") + e.what());
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								log.cpp
								
								
								
								
							
							
						
						
									
										8
									
								
								log.cpp
								
								
								
								
							| 
						 | 
				
			
			@ -29,11 +29,3 @@ void log(std::string entry, time_t time) {
 | 
			
		|||
void log(std::string entry) {
 | 
			
		||||
    log(std::move(entry), time(nullptr));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void log(std::string action, const std::exception& e, time_t time) {
 | 
			
		||||
    log(action + ": " + e.what(), time);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void log(std::string action, const std::exception& e) {
 | 
			
		||||
    log(std::move(action), e, time(nullptr));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								log.h
								
								
								
								
							
							
						
						
									
										2
									
								
								log.h
								
								
								
								
							| 
						 | 
				
			
			@ -8,5 +8,3 @@ extern std::string log_entries;
 | 
			
		|||
 | 
			
		||||
void log(std::string entry, time_t time);
 | 
			
		||||
void log(std::string entry);
 | 
			
		||||
void log(std::string action, const std::exception& e, time_t time);
 | 
			
		||||
void log(std::string action, const std::exception& e);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								main.cpp
								
								
								
								
							
							
						
						
									
										2
									
								
								main.cpp
								
								
								
								
							| 
						 | 
				
			
			@ -117,7 +117,7 @@ int main(int, char**) {
 | 
			
		|||
        io.Fonts->AddFontFromFileTTF(fonts.first.c_str(), config.normal_font_size);
 | 
			
		||||
        monospace_font = io.Fonts->AddFontFromFileTTF(fonts.second.c_str(), config.monospace_font_size);
 | 
			
		||||
    } catch (const std::exception& e) {
 | 
			
		||||
        log("Failed to get fonts", e);
 | 
			
		||||
        log(std::string("Failed to get fonts: ") + e.what());
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    if (!monospace_font) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue