stringToLevel#

Fully qualified name: carb::logging::stringToLevel

Defined in carb/logging/Log.h

inline int32_t carb::logging::stringToLevel(
carb::cpp::string_view levelString,
)#

Convert a given string to a log level.

Finds the log level with the longest common prefix match against the input string. A full match is preferred over a partial match. The comparison is case-insensitive. For example, “warn” will match “warning”, “err” will match “error”, etc.

Parameters:

levelString – An optional string view representing the name of a log level. If empty, kLevelFatal is returned.

Returns:

The log level that best matches the input string. If no match is found, kLevelFatal is returned after an error log is issued.