BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls_logseverity

Detailed Description

Outline

Purpose

Enumerate a set of logging severity levels.

Classes

See also
bsls_log

Description

This component provides a namespace for the enum type bsls::LogSeverity::Enum, which enumerates a set of severity levels used for logging with bsls_log.

Enumerators

Name Description
----------- -------------------------------------------------------------
e_FATAL A severity appropriate for log messages accompanying a fatal
event (i.e., one that will cause a *crash*).
e_ERROR A severity appropriate for log messages accompanying an
unexpected error (i.e., one that will cause incorrect
behavior).
e_WARN A severity appropriate for log messages accompanying an
event that may indicate a problem.
e_INFO A severity appropriate for log messages providing informative
status about the running process.
e_DEBUG A severity appropriate for log messages providing information
useful for debugging.
e_TRACE A severity appropriate for log messages providing detailed
trace information.

Usage

This section illustrates intended use of this component.

Example 1: Basic Syntax

The following snippets of code provide a simple illustration of using bsls::LogSeverity.

First, we create a variable value of type bsls::LogSeverity::Enum and initialize it with the enumerator value bsls::LogSeverity::e_DEBUG:

Enum
Definition bsls_logseverity.h:125
@ e_DEBUG
Definition bsls_logseverity.h:132

Now, we store the address of its ASCII representation in a pointer variable, asciiValue, of type const char *:

const char *asciiValue = bsls::LogSeverity::toAscii(value);
static const char * toAscii(LogSeverity::Enum value)

Finally, we verify the value of asciiValue:

assert(0 == strcmp(asciiValue, "DEBUG"));