Set the formatting functor from the specified scheme‐tagged format.

Synopsis

Declared in <ball_cstdioobserver.h>

int
setFormat(std::string_view const& format);

Description

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

Return Value

0 if the format is valid, and a non‐zero value otherwise

Parameters

Name

Description

format

scheme‐tagged or legacy format specification

Created with MrDocs