summaryrefslogtreecommitdiff
path: root/boost/log/sinks/text_file_backend.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/log/sinks/text_file_backend.hpp')
-rw-r--r--boost/log/sinks/text_file_backend.hpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/boost/log/sinks/text_file_backend.hpp b/boost/log/sinks/text_file_backend.hpp
index 7fe6df80ad..68f698848f 100644
--- a/boost/log/sinks/text_file_backend.hpp
+++ b/boost/log/sinks/text_file_backend.hpp
@@ -27,6 +27,7 @@
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/log/keywords/max_size.hpp>
+#include <boost/log/keywords/max_files.hpp>
#include <boost/log/keywords/min_free_space.hpp>
#include <boost/log/keywords/target.hpp>
#include <boost/log/keywords/file_name.hpp>
@@ -129,7 +130,8 @@ namespace aux {
BOOST_LOG_API shared_ptr< collector > make_collector(
filesystem::path const& target_dir,
uintmax_t max_size,
- uintmax_t min_free_space
+ uintmax_t min_free_space,
+ uintmax_t max_files = (std::numeric_limits< uintmax_t >::max)()
);
template< typename ArgsT >
inline shared_ptr< collector > make_collector(ArgsT const& args)
@@ -137,7 +139,8 @@ namespace aux {
return aux::make_collector(
filesystem::path(args[keywords::target]),
args[keywords::max_size | (std::numeric_limits< uintmax_t >::max)()],
- args[keywords::min_free_space | static_cast< uintmax_t >(0)]);
+ args[keywords::min_free_space | static_cast< uintmax_t >(0)],
+ args[keywords::max_files | (std::numeric_limits< uintmax_t >::max)()]);
}
} // namespace aux
@@ -159,6 +162,11 @@ inline shared_ptr< collector > make_collector(T1 const& a1, T2 const& a2, T3 con
{
return aux::make_collector((a1, a2, a3));
}
+template< typename T1, typename T2, typename T3, typename T4 >
+inline shared_ptr< collector > make_collector(T1 const& a1, T2 const& a2, T3 const& a3, T4 const& a4)
+{
+ return aux::make_collector((a1, a2, a3, a4));
+}
#else
@@ -190,6 +198,9 @@ inline shared_ptr< collector > make_collector(T1 const& a1, T2 const& a2, T3 con
* 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.
+ * \li \c max_files - Specifies the maximum number of log files stored. If the number of files exceeds
+ * this threshold, the oldest file(s) is deleted to free space. The threshhold is
+ * not maintained if not specified.
*
* \return The file collector.
*/