[#absl-StatusBuilder]
= xref:absl.adoc[absl]::StatusBuilder
:relfileprefix: ../
:mrdocs:

Builds an `absl&colon;&colon;Status` enriched with extra context, logging, and payloads&period;

== Synopsis

Declared in `&lt;absl&sol;status&sol;status&lowbar;builder&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class &lsqb;&lsqb;nodiscard&rsqb;&rsqb; StatusBuilder;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/StatusBuilder/2constructor-06.adoc[`StatusBuilder`]         [.small]#[constructor]#
| Constructors
| xref:absl/StatusBuilder/2destructor.adoc[`&#126;StatusBuilder`] [.small]#[destructor]#
| Destroys the builder&period;
| xref:absl/StatusBuilder/operator_assign-0a9.adoc[`operator&equals;`] 
| 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&period;
| 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&period;
| xref:absl/StatusBuilder/GetPayload.adoc[`GetPayload`] 
| Returns the payload associated with `type&lowbar;url`, if present&period;
| xref:absl/StatusBuilder/GetPreviousSourceLocations.adoc[`GetPreviousSourceLocations`] 
| Returns the source locations previously recorded in the status&period;
| xref:absl/StatusBuilder/HasPayload.adoc[`HasPayload`] 
| Indicates whether the result status contains any `MessageSet` payloads&period;
| 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&period;
| xref:absl/StatusBuilder/LogError-0d.adoc[`LogError`] 
| Logs the result status at severity `kError`&period;
| 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&period;
| 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&period;
| xref:absl/StatusBuilder/LogInfo-0b.adoc[`LogInfo`] 
| Logs the result status at severity `kInfo`&period;
| xref:absl/StatusBuilder/LogWarning-0d.adoc[`LogWarning`] 
| Logs the result status at severity `kWarning`&period;
| 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&period;
| 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&period;
| xref:absl/StatusBuilder/SetCode-08.adoc[`SetCode`] 
| Sets the status code for the status that will be returned by this StatusBuilder&period;
| xref:absl/StatusBuilder/SetErrorCode-0a.adoc[`SetErrorCode`] 
| Sets a non&hyphen;canonical error code on the result status&period;
| xref:absl/StatusBuilder/SetNoLogging-0b.adoc[`SetNoLogging`] 
| Mutates the builder to disable any logging that was set using any of the logging functions below&period;
| xref:absl/StatusBuilder/SetPayload-0009.adoc[`SetPayload`] 
| Adds a payload for the status that will be returned by this StatusBuilder&period;
| 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&period;
| xref:absl/StatusBuilder/ToString.adoc[`ToString`] 
| Returns a string representation of the status this builder would produce&period;
| 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&period;
| xref:absl/StatusBuilder/With-07.adoc[`With`] 
| Calls `adaptor` on this status builder to apply policies, type conversions, and&sol;or side effects on the StatusBuilder&period;
| xref:absl/StatusBuilder/code.adoc[`code`] 
| Returns the (canonical) error code for the Status created by this builder&period;
| xref:absl/StatusBuilder/ok.adoc[`ok`] 
| Returns true if the Status created by this builder will be ok()&period;
| xref:absl/StatusBuilder/source_location.adoc[`source&lowbar;location`] 
| Returns the source location used to create this builder&period;
| xref:absl/StatusBuilder/2conversion-05.adoc[`operator absl&colon;&colon;Status`] 
| Implicit conversion to Status&period;
| xref:absl/StatusBuilder/operator_lshift-0e.adoc[`operator&lt;&lt;`] 
| Appends to the extra message that will be added to the original status&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:absl/StatusBuilderTest.adoc[absl::StatusBuilderTest]`
| Test fixture granted access to `Rep`&apos;s implementation&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/AbslInternalSetErrorCode.adoc[`AbslInternalSetErrorCode`]
| Argument&hyphen;dependent lookup extension point that sets a `StatusBuilder`&apos;s error code&period;
| xref:absl/HasPayload.adoc[`HasPayload`]
| Indicates whether the status that `builder` will return has a `MessageSet` payload&period;
|===

== 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]#
