Boost C++ Libraries

PrevUpHomeNext

Function template init_log_to_file

boost::log::init_log_to_file

Synopsis

// In header: <boost/log/utility/init/to_file.hpp>


template<typename CharT, typename... ArgsT> 
  shared_ptr< sinks::synchronous_sink< sinks::basic_text_file_backend< CharT > >> 
  init_log_to_file(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 file name or its pattern. This parameter is mandatory.

  • 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.

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

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

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

  • scan_method The method of scanning the target directory for log files. See 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