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

Enable log file cleanup on `observer` using the specified `config`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;OBSERVER&gt;
static
void
enableLogFileCleanup(
    t&lowbar;OBSERVER* observer,
    xref:BloombergLP/balb/FileCleanerConfiguration.adoc[balb::FileCleanerConfiguration] const& config);
----

== Description

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;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *observer*
| file observer that receives the rotation callback
| *config*
| configuration used for immediate and rotation cleanup
|===


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