[#BloombergLP-ball-LogFileCleanerUtil]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::LogFileCleanerUtil
:relfileprefix: ../../
:mrdocs:

This utility class provides functions for converting log file patterns and for cleaning up log files based on a configuration&period;

== Synopsis

Declared in `&lt;ball&lowbar;logfilecleanerutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct LogFileCleanerUtil;
----

== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/ball/LogFileCleanerUtil/enableLogFileCleanup.adoc[`enableLogFileCleanup`] 
| Immediately call `balb&colon;&colon;FileCleanerUtil&colon;&colon;removeFiles` with the specified `config` and then install an `t&lowbar;OBSERVER&colon;&colon;OnFileRotationCallback` function into the specified `observer` that invokes `removeFiles` synchronously on every log file rotation&period; The (template parameter) `t&lowbar;OBSERVER` type must provide concrete implementation of the `ball&colon;&colon;Observer` protocol, have a `setOnFileRotationCallback` method (see `ball&lowbar;fileobserver`, `ball&lowbar;fileobserver2`, and `ball&lowbar;asyncfileobserver`), and define an `OnFileRotationCallback` type alias&period; This method overrides the file rotation callback currently installed in the observer (if any)&period;
| xref:BloombergLP/ball/LogFileCleanerUtil/logPatternToFilePattern.adoc[`logPatternToFilePattern`] 
| Substitute all occurrences of valid `%`&hyphen;escape sequences in the specified `logPattern` with `&ast;` and load the specified `filePattern` with the resulting string&period; This utility function converts the log patterns used by various file observers and supplied to their `enableFileLogging` method (see `ball&lowbar;fileobserver`, `ball&lowbar;fileobserver2`, and `ball&lowbar;asyncfileobserver`) to the file pattern used by various utility functions to find the related file(s) on the filesystem (see `balb&lowbar;filecleanerutil` and `balb&lowbar;filecleanerconfiguration`)&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
