[#absl-StatusBuilder] = xref:absl.adoc[absl]::StatusBuilder :relfileprefix: ../ :mrdocs: Builds an `absl::Status` enriched with extra context, logging, and payloads. == Synopsis Declared in `<absl/status/status_builder.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class [[nodiscard]] StatusBuilder; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/StatusBuilder/2constructor-06.adoc[`StatusBuilder`] [.small]#[constructor]# | Constructors | xref:absl/StatusBuilder/2destructor.adoc[`~StatusBuilder`] [.small]#[destructor]# | Destroys the builder. | xref:absl/StatusBuilder/operator_assign-0a9.adoc[`operator=`] | Assignment operators | xref:absl/StatusBuilder/AlsoOutputToSink-02.adoc[`AlsoOutputToSink`] | Mutates the builder so that the result status will also be logged to the provided `sink` when this builder is converted to a status. | xref:absl/StatusBuilder/AttachPayload-0a8.adoc[`AttachPayload`] | `AttachPayload` overloads | xref:absl/StatusBuilder/EmitStackTrace-07.adoc[`EmitStackTrace`] | Mutates the builder so that a stack trace will be logged if the status is logged. | xref:absl/StatusBuilder/GetPayload.adoc[`GetPayload`] | Returns the payload associated with `type_url`, if present. | xref:absl/StatusBuilder/GetPreviousSourceLocations.adoc[`GetPreviousSourceLocations`] | Returns the source locations previously recorded in the status. | xref:absl/StatusBuilder/HasPayload.adoc[`HasPayload`] | Indicates whether the result status contains any `MessageSet` payloads. | xref:absl/StatusBuilder/Log-02.adoc[`Log`] | Mutates the builder so that the result status will be logged (without a stack trace) when this builder is converted to a Status. | xref:absl/StatusBuilder/LogError-0d.adoc[`LogError`] | Logs the result status at severity `kError`. | xref:absl/StatusBuilder/LogEvery-0b.adoc[`LogEvery`] | Mutates the builder so that the result status will be logged once per period (without a stack trace) when this builder is converted to a Status. | xref:absl/StatusBuilder/LogEveryN-0e.adoc[`LogEveryN`] | Mutates the builder so that the result status will be logged every N invocations (without a stack trace) when this builder is converted to a Status. | xref:absl/StatusBuilder/LogInfo-0b.adoc[`LogInfo`] | Logs the result status at severity `kInfo`. | xref:absl/StatusBuilder/LogWarning-0d.adoc[`LogWarning`] | Logs the result status at severity `kWarning`. | xref:absl/StatusBuilder/OnlyOutputToSink-01.adoc[`OnlyOutputToSink`] | Mutates the builder so that the result status will only be logged to the provided `sink` when this builder is converted to a status. | xref:absl/StatusBuilder/SetAppend-0bb.adoc[`SetAppend`] | Mutates the builder so that the final additional message is appended to the original error message in the status. | xref:absl/StatusBuilder/SetCode-08.adoc[`SetCode`] | Sets the status code for the status that will be returned by this StatusBuilder. | xref:absl/StatusBuilder/SetErrorCode-0a.adoc[`SetErrorCode`] | Sets a non‐canonical error code on the result status. | xref:absl/StatusBuilder/SetNoLogging-0b.adoc[`SetNoLogging`] | Mutates the builder to disable any logging that was set using any of the logging functions below. | xref:absl/StatusBuilder/SetPayload-0009.adoc[`SetPayload`] | Adds a payload for the status that will be returned by this StatusBuilder. | xref:absl/StatusBuilder/SetPrepend-0c.adoc[`SetPrepend`] | Mutates the builder so that the final additional message is prepended to the original error message in the status. | xref:absl/StatusBuilder/ToString.adoc[`ToString`] | Returns a string representation of the status this builder would produce. | xref:absl/StatusBuilder/VLog-03.adoc[`VLog`] | Mutates the builder so that the result status will be VLOGged (without a stack trace) when this builder is converted to a Status. | xref:absl/StatusBuilder/With-07.adoc[`With`] | Calls `adaptor` on this status builder to apply policies, type conversions, and/or side effects on the StatusBuilder. | xref:absl/StatusBuilder/code.adoc[`code`] | Returns the (canonical) error code for the Status created by this builder. | xref:absl/StatusBuilder/ok.adoc[`ok`] | Returns true if the Status created by this builder will be ok(). | xref:absl/StatusBuilder/source_location.adoc[`source_location`] | Returns the source location used to create this builder. | xref:absl/StatusBuilder/2conversion-05.adoc[`operator absl::Status`] | Implicit conversion to Status. | xref:absl/StatusBuilder/operator_lshift-0e.adoc[`operator<<`] | Appends to the extra message that will be added to the original status. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:absl/StatusBuilderTest.adoc[absl::StatusBuilderTest]` | Test fixture granted access to `Rep`'s implementation. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/AbslInternalSetErrorCode.adoc[`AbslInternalSetErrorCode`] | Argument‐dependent lookup extension point that sets a `StatusBuilder`'s error code. | xref:absl/HasPayload.adoc[`HasPayload`] | Indicates whether the status that `builder` will return has a `MessageSet` payload. |=== == Return Value [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== [.small]#Created with https://www.mrdocs.com[MrDocs]#