Merge pull request #1430 from tt4g/add-critical-section-to-filename-api
Add critical section to filename function of each file sink
This commit is contained in:
		@@ -70,8 +70,9 @@ public:
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const filename_t &filename() const
 | 
					    const filename_t &filename()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
 | 
				
			||||||
        return file_helper_.filename();
 | 
					        return file_helper_.filename();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,8 +54,9 @@ SPDLOG_INLINE filename_t rotating_file_sink<Mutex>::calc_filename(const filename
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename Mutex>
 | 
					template<typename Mutex>
 | 
				
			||||||
SPDLOG_INLINE const filename_t &rotating_file_sink<Mutex>::filename() const
 | 
					SPDLOG_INLINE const filename_t &rotating_file_sink<Mutex>::filename()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
 | 
				
			||||||
    return file_helper_.filename();
 | 
					    return file_helper_.filename();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ class rotating_file_sink final : public base_sink<Mutex>
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
    rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false);
 | 
					    rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false);
 | 
				
			||||||
    static filename_t calc_filename(const filename_t &filename, std::size_t index);
 | 
					    static filename_t calc_filename(const filename_t &filename, std::size_t index);
 | 
				
			||||||
    const filename_t &filename() const;
 | 
					    const filename_t &filename();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    void sink_it_(const details::log_msg &msg) override;
 | 
					    void sink_it_(const details::log_msg &msg) override;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user