Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Function template add_file_log

boost::log::add_file_log

Synopsis

// In header: <boost/log/utility/setup/file.hpp>


template<typename... ArgsT> 
  shared_ptr< sinks::synchronous_sink< sinks::text_file_backend > > 
  add_file_log(ArgsT... const & args);

Description

The function initializes the logging library to write logs to a file stream.

Parameters:

args

A number of named arguments. The following parameters are supported:

  • file_name The active file name or its pattern. This parameter is mandatory.

  • target_file_name - Specifies the target file name pattern to use to rename the log file on rotation, before passing it to the file collector. The pattern may contain the same placeholders as the file_name parameter. By default, no renaming is done, i.e. the written log file keeps its name according to file_name.

  • open_mode The mask that describes the open mode for the file. See std::ios_base::openmode.

  • rotation_size The size of the file at which rotation should occur. See basic_text_file_backend.

  • time_based_rotation The predicate for time-based file rotations. See basic_text_file_backend.

  • auto_flush A boolean flag that shows whether the sink should automatically flush the file after each written record.

  • auto_newline_mode - Specifies automatic trailing newline insertion mode. Must be a value of the auto_newline_mode enum. By default, is auto_newline_mode::insert_if_missing.

  • target The target directory to store rotated files in. See sinks::file::make_collector.

  • max_size The maximum total size of rotated files in the target directory. See sinks::file::make_collector.

  • min_free_space Minimum free space in the target directory. See sinks::file::make_collector.

  • max_files The maximum total number of rotated files in the target directory. See sinks::file::make_collector.

  • scan_method The method of scanning the target directory for log files. See sinks::file::scan_method.

  • filter Specifies a filter to install into the sink. May be a string that represents a filter, or a filter lambda expression.

  • format Specifies a formatter to install into the sink. May be a string that represents a formatter, or a formatter lambda expression (either streaming or Boost.Format-like notation).

Returns:

Pointer to the constructed sink.


PrevUpHomeNext