forked from quickshell/quickshell
		
	core/log: stop trying to store detailed logs after write fail
Not stopping will cause the logger's write buffer to fill until OOM if writing fails.
This commit is contained in:
		
							parent
							
								
									63a6d27213
								
							
						
					
					
						commit
						759bd721df
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
					@ -457,10 +457,14 @@ void ThreadLogging::onMessage(const LogMessage& msg, bool showInSparse) {
 | 
				
			||||||
		this->fileStream << Qt::endl;
 | 
							this->fileStream << Qt::endl;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->detailedWriter.write(msg)) {
 | 
						if (!this->detailedWriter.write(msg) || (this->detailedFile && !this->detailedFile->flush())) {
 | 
				
			||||||
		this->detailedFile->flush();
 | 
							if (this->detailedFile) {
 | 
				
			||||||
	} else if (this->detailedFile != nullptr) {
 | 
								qCCritical(logLogging) << "Detailed logger failed to write. Ending detailed logs.";
 | 
				
			||||||
		qCCritical(logLogging) << "Detailed logger failed to write. Ending detailed logs.";
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this->detailedWriter.setDevice(nullptr);
 | 
				
			||||||
 | 
							this->detailedFile->close();
 | 
				
			||||||
 | 
							this->detailedFile = nullptr;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue