CppTrail
Loading...
Searching...
No Matches
CppTrail::Detail::LevelName< char_t > Struct Template Reference

Template utility to map Level enums to string representations. More...

#include <def.h>

Public Types

using string_view_type = std::basic_string_view< char_t >
 Maps to std::string_view on C++17+, or CppTrail's fallback view on older standards.
 

Static Public Member Functions

static std::basic_string< char_t > getName (Level nLevel)
 Retrieves the level name as a basic_string.
 
static std::basic_string_view< char_t > getNameView (Level nLevel) noexcept
 Retrieves a view of the level name.
 

Static Public Attributes

static constexpr std::array< string_view_type, 9 > NAMES
 Static array of localized/encoded level names.
 

Detailed Description

template<typename char_t>
struct CppTrail::Detail::LevelName< char_t >

Template utility to map Level enums to string representations.

Template Parameters
char_tThe character type (char, char8_t, char16_t, char32_t).

Member Function Documentation

◆ getName()

template<typename char_t >
static std::basic_string< char_t > CppTrail::Detail::LevelName< char_t >::getName ( Level  nLevel)
inlinestatic

Retrieves the level name as a basic_string.

Parameters
nLevelThe log level.
Returns
A string containing the level name, or an empty string if invalid.

◆ getNameView()

template<typename char_t >
static std::basic_string_view< char_t > CppTrail::Detail::LevelName< char_t >::getNameView ( Level  nLevel)
inlinestaticnoexcept

Retrieves a view of the level name.

Parameters
nLevelThe log level.
Returns
A string_view pointing to the static name buffer.

Member Data Documentation

◆ NAMES

template<typename char_t >
constexpr std::array<string_view_type, 9> CppTrail::Detail::LevelName< char_t >::NAMES
staticconstexpr
Initial value:
= {
make_poly_enc(char_t, "SUCCESS"),
make_poly_enc(char_t, "TRACE"),
make_poly_enc(char_t, "DEBUG"),
make_poly_enc(char_t, "INFO"),
make_poly_enc(char_t, "MESSAGE"),
make_poly_enc(char_t, "WARNING"),
make_poly_enc(char_t, "ERROR"),
make_poly_enc(char_t, "CRITICAL"),
make_poly_enc(char_t, "FATAL"),
}
#define make_poly_enc(char_t, lit)
Creates a compile-time polymorphic encoded string literal.
Definition utf42.h:80

Static array of localized/encoded level names.


The documentation for this struct was generated from the following file: