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

Four severity levels are defined&period; Logging APIs should terminate the program when a message is logged at severity `kFatal`&semi; the other levels have no special semantics&period;

== Synopsis

Declared in `&lt;absl&sol;base&sol;log&lowbar;severity&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
enum class LogSeverity : int;
----

== Description

Values other than the four defined levels (e&period;g&period; produced by `static&lowbar;cast`) are valid, but their semantics when passed to a function, macro, or flag depend on the function, macro, or flag&period; The usual behavior is to normalize such values to a defined severity level, however in some cases values other than the defined levels are useful for comparison&period;

Example&colon;

&sol;&sol; Effectively disables all logging&colon; SetMinLogLevel(static&lowbar;cast&lt;absl&colon;&colon;LogSeverity&gt;(100))&semi;

Abseil flags may be defined with type `LogSeverity`&period; Dependency layering constraints require that the `AbslParseFlag()` overload be declared and defined in the flags library itself rather than here&period; The `AbslUnparseFlag()` overload is defined there as well for consistency&period;

absl&colon;&colon;LogSeverity Flag String Representation

An `absl&colon;&colon;LogSeverity` has a string representation used for parsing command&hyphen;line flags based on the enumerator name (e&period;g&period; `kFatal`) or its unprefixed name (without the `k`) in any case&hyphen;insensitive form&period; (E&period;g&period; &quot;FATAL&quot;, &quot;fatal&quot; or &quot;Fatal&quot; are all valid&period;) Unparsing such flags produces an unprefixed string representation in all caps (e&period;g&period; &quot;FATAL&quot;) or an integer&period;

Additionally, the parser accepts arbitrary integers (as if the type were `int`)&period;

Examples&colon;

&hyphen;&hyphen;my&lowbar;log&lowbar;level&equals;kInfo &hyphen;&hyphen;my&lowbar;log&lowbar;level&equals;INFO &hyphen;&hyphen;my&lowbar;log&lowbar;level&equals;info &hyphen;&hyphen;my&lowbar;log&lowbar;level&equals;0

`DFATAL` and `kLogDebugFatal` are similarly accepted&period;

Unparsing a flag produces the same result as `absl&colon;&colon;LogSeverityName()` for the standard levels and a base&hyphen;ten integer otherwise&period;

== Members

[cols="1,4"]
|===
| Name| Description
| `kInfo` 
| Informational message&semi; no special semantics&period;
| `kWarning` 
| Warning message&semi; no special semantics&period;
| `kError` 
| Error message&semi; no special semantics&period;
| `kFatal` 
| Fatal message&semi; logging APIs should terminate the program&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/AbslUnparseFlag-09.adoc[`AbslUnparseFlag`]
| Unparses an `absl&colon;&colon;LogSeverity` flag value&period; See `base&sol;log&lowbar;severity&period;h` for the full documentation&period;
| xref:absl/LogSeverities.adoc[`LogSeverities`]
| Returns an iterable of all standard `absl&colon;&colon;LogSeverity` values, ordered from least to most severe&period;
| xref:absl/LogSeverityName.adoc[`LogSeverityName`]
| Returns the all&hyphen;caps string representation (e&period;g&period; &quot;INFO&quot;) of the specified severity level if it is one of the standard levels and &quot;UNKNOWN&quot; otherwise&period;
| xref:absl/NormalizeLogSeverity-072.adoc[`NormalizeLogSeverity`]
| Overload that normalizes a raw integer as if it were an `absl&colon;&colon;LogSeverity`&period;
| xref:absl/NormalizeLogSeverity-07a.adoc[`NormalizeLogSeverity`]
| Values less than `kInfo` normalize to `kInfo`&semi; values greater than `kFatal` normalize to `kError` (*NOT* `kFatal`)&period;
| xref:absl/SetStderrThreshold-0f.adoc[`SetStderrThreshold`]
| Updates the Stderr Threshold parameter&period;
| xref:absl/operator_lt-065.adoc[`operator&lt;`]
| Compares an `absl&colon;&colon;LogSeverityAtLeast` threshold against an `absl&colon;&colon;LogSeverity` value (in either operand order)&period;
| xref:absl/operator_le-08.adoc[`operator&lt;&equals;`]
| Compares an `absl&colon;&colon;LogSeverityAtMost` threshold against an `absl&colon;&colon;LogSeverity` value (in either operand order)&period;
| xref:absl/operator_gt-0a.adoc[`operator&gt;`]
| Compares an `absl&colon;&colon;LogSeverityAtMost` threshold against an `absl&colon;&colon;LogSeverity` value (in either operand order)&period;
| xref:absl/operator_ge-0a5.adoc[`operator&gt;&equals;`]
| Compares an `absl&colon;&colon;LogSeverityAtLeast` threshold against an `absl&colon;&colon;LogSeverity` value (in either operand order)&period;
|===


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