|
| QUILL_ATTRIBUTE_COLD void | set_filename_append_option (FilenameAppendOption value, std::string_view append_filename_format_pattern=std::string_view{}) |
| | Sets the append type for the file name. More...
|
| |
| QUILL_ATTRIBUTE_COLD void | set_timezone (Timezone time_zone) |
| | Sets the timezone to use for time-based operations e.g. More...
|
| |
| QUILL_ATTRIBUTE_COLD void | set_fsync_enabled (bool value) |
| | Sets whether fsync should be performed when flushing. More...
|
| |
| QUILL_ATTRIBUTE_COLD void | set_open_mode (char open_mode) |
| | Sets the open mode for the file. More...
|
| |
| QUILL_ATTRIBUTE_COLD void | set_open_mode (std::string_view open_mode) |
| | Sets the open mode for the file. More...
|
| |
| QUILL_ATTRIBUTE_COLD void | set_write_buffer_size (size_t value) |
| | Sets the user-defined buffer size for fwrite operations. More...
|
| |
| QUILL_ATTRIBUTE_COLD void | set_minimum_fsync_interval (std::chrono::milliseconds value) |
| | Sets the minimum interval between fsync calls. More...
|
| |
| QUILL_ATTRIBUTE_COLD void | set_override_pattern_formatter_options (std::optional< PatternFormatterOptions > const &options) |
| | Sets custom pattern formatter options for this sink. More...
|
| |
|
QUILL_NODISCARD bool | fsync_enabled () const noexcept |
| | Getters.
|
| |
|
QUILL_NODISCARD Timezone | timezone () const noexcept |
| |
|
QUILL_NODISCARD FilenameAppendOption | filename_append_option () const noexcept |
| |
|
QUILL_NODISCARD std::string const & | append_filename_format_pattern () const noexcept |
| |
|
QUILL_NODISCARD std::string const & | open_mode () const noexcept |
| |
|
QUILL_NODISCARD size_t | write_buffer_size () const noexcept |
| |
|
QUILL_NODISCARD std::chrono::milliseconds | minimum_fsync_interval () const noexcept |
| |
|
QUILL_NODISCARD std::optional< PatternFormatterOptions > const & | override_pattern_formatter_options () const noexcept |
| |
The FileSinkConfig class holds the configuration options for the FileSink.
| QUILL_ATTRIBUTE_COLD void FileSinkConfig::set_filename_append_option |
( |
FilenameAppendOption |
value, |
|
|
std::string_view |
append_filename_format_pattern = std::string_view{} |
|
) |
| |
|
inline |
Sets the append type for the file name.
Possible append types are: StartDate, StartDateTime or None. When this option is set, the file name will be appended with the start date or date and time timestamp of when the process started.
For example: application.log -> application_20230101.log (StartDate) application.log -> application_20230101_121020.log (StartDateTime)
- Parameters
-
| value | The append type to set. Valid options are Date and DateAndTime. |
| append_filename_format_pattern | Specifies a custom strftime format pattern to use for the filename. This parameter is only applicable when FilenameAppendOption::CustomDateTimeFormat is selected |
| QUILL_ATTRIBUTE_COLD void FileSinkConfig::set_minimum_fsync_interval |
( |
std::chrono::milliseconds |
value | ) |
|
|
inline |
Sets the minimum interval between fsync calls.
This specifies the minimum time between consecutive fsync operations but does not guarantee that fsync will be called exactly at that interval.
For example, if some messages are flushed to the log and fsync is skipped because it was previously called, and no further messages are written to the file, fsync will not be called even if the minimum interval has passed. This is because the previous call was skipped due to the interval, and no new messages necessitate another fsync call.
This feature is intended to mitigate concerns about frequent fsync calls potentially causing disk wear.
Note: This option is only applicable when fsync is enabled. By default, the value is 0, which means that fsync will be called periodically by the backend worker thread when messages are written to the file, irrespective of the interval.
- Parameters
-
| value | The minimum interval, in milliseconds, between fsync calls. |
| QUILL_ATTRIBUTE_COLD void FileSinkConfig::set_write_buffer_size |
( |
size_t |
value | ) |
|
|
inline |
Sets the user-defined buffer size for fwrite operations.
This function allows you to specify a custom buffer size for fwrite, improving efficiency for file write operations.
To disable custom buffering and revert to the default size, pass a value of 0.
- Note
- By default, a buffer size of 64 KB is used.
- Parameters
-
| value | Size of the buffer in bytes. If set to 0, the default buffer size will be used. |