|
Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
|
String utility functions for log formatting and conversion. More...
#include <string_utils.h>

Static Public Member Functions | |
| static std::string | level_to_string (log_level level) |
| Convert log level to human-readable string. | |
| static std::string | level_to_color (log_level level, bool use_colors=true) |
| Convert log level to ANSI color code. | |
| static const char * | color_reset () |
| ANSI color reset sequence. | |
| static std::string | escape_json (const std::string &str) |
| Escape special characters for JSON. | |
| static std::string | escape_xml (const std::string &str) |
| Escape special characters for XML. | |
| static std::string | extract_filename (const std::string &file_path) |
| Extract filename from full file path. | |
| static std::string | trim (const std::string &str) |
| Trim whitespace from both ends of string. | |
| static std::string | to_lower (const std::string &str) |
| Convert string to lowercase. | |
| static std::string | to_upper (const std::string &str) |
| Convert string to uppercase. | |
| static std::string | replace_all (const std::string &str, const std::string &from, const std::string &to) |
| Replace all occurrences of a substring. | |
String utility functions for log formatting and conversion.
Provides common string manipulation functions used across formatters and writers, including escaping, conversion, and extraction utilities.
Definition at line 31 of file string_utils.h.
|
inlinestatic |
ANSI color reset sequence.
Definition at line 95 of file string_utils.h.
Referenced by kcenon::logger::timestamp_formatter::format(), and kcenon::logger::template_formatter::resolve_placeholder().

|
inlinestatic |
Escape special characters for JSON.
| str | String to escape |
Escaped characters:
Definition at line 114 of file string_utils.h.
Referenced by kcenon::logger::json_formatter::format(), and kcenon::logger::json_formatter::format_value().

|
inlinestatic |
Escape special characters for XML.
| str | String to escape |
Escaped characters:
Definition at line 155 of file string_utils.h.
|
inlinestatic |
Extract filename from full file path.
| file_path | Full path to file (may include directories) |
Examples:
Definition at line 183 of file string_utils.h.
Referenced by kcenon::logger::timestamp_formatter::format(), and kcenon::logger::template_formatter::resolve_placeholder().

|
inlinestatic |
Convert log level to ANSI color code.
| level | Log level to convert |
| use_colors | Whether to return colors (if false, returns empty string) |
Color mapping:
Definition at line 72 of file string_utils.h.
Referenced by kcenon::logger::timestamp_formatter::format(), and kcenon::logger::template_formatter::resolve_placeholder().

|
inlinestatic |
Convert log level to human-readable string.
| level | Log level to convert |
Output format: "CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE", "OFF"
Definition at line 42 of file string_utils.h.
Referenced by kcenon::logger::json_formatter::format(), kcenon::logger::timestamp_formatter::format(), kcenon::logger::network_writer::format_for_network(), and kcenon::logger::template_formatter::resolve_placeholder().

|
inlinestatic |
Replace all occurrences of a substring.
| str | Source string |
| from | Substring to replace |
| to | Replacement substring |
Definition at line 262 of file string_utils.h.
|
inlinestatic |
Convert string to lowercase.
| str | String to convert |
Definition at line 224 of file string_utils.h.
Referenced by kcenon::logger::template_formatter::resolve_placeholder().

|
inlinestatic |
Convert string to uppercase.
| str | String to convert |
Definition at line 242 of file string_utils.h.
|
inlinestatic |
Trim whitespace from both ends of string.
| str | String to trim |
Definition at line 204 of file string_utils.h.