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

Set the formatting functor used when writing records to the log file of this file observer to a log file functor created according to the specified, possibly URI&hyphen;like scheme tagged, `format`&period; Return zero if the setup with the specified arguments was successful and also save the `format` to be later retrievable using `getFormat`&period; Otherwise (if no matching scheme could be found or the configuration is invalid) return a non&hyphen;zero value and do not change the log record formatter used by this object&period; Note that a default format (&quot;n%d %p&colon;%t %s %f&colon;%l %c %m %un&quot;) is in effect until this method or `setLogFileFunctor` is called&period; Also, notice that the observer emits newline characters at the beginning and at the end of a log record by default, so the user needs to add them explicitly to (text) format strings to preserve that behavior&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
setFormat(std::string&lowbar;view const& format);
----


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