...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::sinks::file::collector — Base class for file collectors.
// In header: <boost/log/sinks/text_file_backend.hpp> struct collector { // construct/copy/destruct collector() = default; collector(collector const &) = delete; collector& operator=(collector const &) = delete; ~collector(); // public member functions void store_file(filesystem::path const &); uintmax_t scan_for_files(scan_method, filesystem::path const & = filesystem::path(), unsigned int * = 0); };
All file collectors, supported by file sink backends, should inherit this class.
collector
public member functionsvoid store_file(filesystem::path const & src_path);
The function stores the specified file in the storage. May lead to an older file deletion and a long file moving.
Parameters: |
|
uintmax_t scan_for_files(scan_method method, filesystem::path const & pattern = filesystem::path(), unsigned int * counter = 0);
Scans the target directory for the files that have already been stored. The found files are added to the collector in order to be tracked and erased, if needed.
The function may scan the directory in two ways: it will either consider every file in the directory a log file, or will only consider files with names that match the specified pattern. The pattern may contain the following placeholders:
y, Y, m, d - date components, in Boost.DateTime meaning.
H, M, S, f - time components, in Boost.DateTime meaning.
N - numeric file counter. May also contain width specification in printf-compatible form (e.g. %5N). The resulting number will always be zero-filled.
%% - a percent sign
All other placeholders are not supported.
Note | |
---|---|
In case if method is |
Parameters: |
|
||||||
Returns: |
The number of found files. |