Boost C++ Libraries

PrevUpHomeNext

Function template make_collector

boost::log::sinks::file::make_collector

Synopsis

// In header: <boost/log/sinks/text_file_backend.hpp>


template<typename... ArgsT> 
  shared_ptr< collector > make_collector(ArgsT...const & args);

Description

The function creates a file collector for the specified target directory. Each target directory is managed by a single file collector, so if this function is called several times for the same directory, it will return a reference to the same file collector. It is safe to use the same collector in different sinks, even in a multithreaded application.

One can specify certain restrictions for the stored files, such as maximum total size or minimum free space left in the target directory. If any of the specified restrictions is not met, the oldest stored file is deleted. If the same collector is requested more than once with different restrictions, the collector will act according to the most strict combination of all specified restrictions.

The following named parameters are supported:

  • target - Specifies the target directory for the files being stored in. This parameter is mandatory.

  • max_size - Specifies the maximum total size, in bytes, of stored files that the collector will try not to exceed. If the size exceeds this threshold the oldest file(s) is deleted to free space. Note that the threshold may be exceeded if the size of individual files exceed the max_size value. The threshold is not maintained, if not specified.

  • min_free_space - Specifies the minimum free space, in bytes, in the target directory that the collector tries to maintain. If the threshold is exceeded, the oldest file(s) is deleted to free space. The threshold is not maintained, if not specified.

Returns:

The file collector.


PrevUpHomeNext