Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::sinks::file::collector Struct Referenceabstract

Base class for file collectors. More...

#include <text_file_backend.hpp>

Public Member Functions

virtual ~collector ()
 Default constructor. More...
 
virtual void store_file (filesystem::path const &src_path)=0
 The function stores the specified file in the storage. More...
 
virtual uintmax_t scan_for_files (scan_method method, filesystem::path const &pattern=filesystem::path(), unsigned int *counter=0)=0
 Scans the target directory for the files that have already been stored. More...
 

Detailed Description

Base class for file collectors.

All file collectors, supported by file sink backends, should inherit this class.

Constructor & Destructor Documentation

virtual boost::sinks::file::collector::~collector ( )
inlinevirtual

Default constructor.

Virtual destructor

Member Function Documentation

virtual uintmax_t boost::sinks::file::collector::scan_for_files ( scan_method  method,
filesystem::path const &  pattern = filesystem::path(),
unsigned int *  counter = 0 
)
pure virtual

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.

Parameters
methodThe method of scanning. If no_scan is specified, the call has no effect.
patternThe file name pattern if method is scan_matching. Otherwise the parameter is not used.
counterIf not NULL and method is scan_matching, the method suggests initial value of a file counter that may be used in the file name pattern. The parameter is not used otherwise.
Returns
The number of found files.
Note
In case if method is scan_matching the effect of this function is highly dependent on the pattern definition. It is recommended to choose patterns with easily distinguished placeholders (i.e. having delimiters between them). Otherwise either some files can be mistakenly found or not found, which in turn may lead to an incorrect file deletion.
virtual void boost::sinks::file::collector::store_file ( filesystem::path const &  src_path)
pure virtual

The function stores the specified file in the storage.

May lead to an older file deletion and a long file moving.

Parameters
src_pathThe name of the file to be stored

The documentation for this struct was generated from the following file: