flush before rotating
This commit is contained in:
		@@ -76,11 +76,15 @@ SPDLOG_INLINE void rotating_file_sink<Mutex>::sink_it_(const details::log_msg &m
 | 
			
		||||
    // rotate if the new estimated file size exceeds max size.
 | 
			
		||||
    // rotate only if the real size > 0 to better deal with full disk (see issue #2261).
 | 
			
		||||
    // we only check the real size when new_size > max_size_ because it is relatively expensive.
 | 
			
		||||
    if (new_size > max_size_ && file_helper_.size() > 0)
 | 
			
		||||
    if (new_size > max_size_)
 | 
			
		||||
    {
 | 
			
		||||
        file_helper_.flush();
 | 
			
		||||
        if(file_helper_.size() > 0)
 | 
			
		||||
        {
 | 
			
		||||
            rotate_();
 | 
			
		||||
            new_size = formatted.size();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    file_helper_.write(formatted);
 | 
			
		||||
    current_size_ = new_size;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user