LogIt++
|
The primary namespace for the LogIt++ library. More...
Classes | |
class | ConsoleLogger |
Logger that outputs log messages to the console with optional color coding. More... | |
class | FileLogger |
Logger that outputs log messages to files with date-based rotation and old file deletion. More... | |
struct | FormatInstruction |
Structure to store log formatting instructions. More... | |
interface | ILogFormatter |
Interface for formatting log records. More... | |
interface | ILogger |
Interface for loggers that handle log message output. More... | |
class | Logger |
Singleton class that manages multiple loggers and formatters. More... | |
struct | LogRecord |
Stores log metadata and content. More... | |
class | LogStream |
A stream-based logger that collects log messages using the << operator. More... | |
struct | PathComponents |
Structure to hold the root and components of a path. More... | |
class | PatternCompiler |
Compiler for log formatting patterns. More... | |
class | SimpleLogFormatter |
A simple log formatter that formats log messages based on a user-defined pattern. More... | |
class | TaskExecutor |
A thread-safe task executor that processes tasks in a dedicated worker thread. More... | |
class | UniqueFileLogger |
Logger that writes each log message to a unique file with date-time and hash in the filename. More... | |
struct | VariableValue |
Structure for storing values of various types, including enumerations. More... | |
Typedefs | |
using | crev_it_t = std::string::const_reverse_iterator |
Enumerations | |
enum class | LogLevel { LOG_LVL_TRACE , LOG_LVL_DEBUG , LOG_LVL_INFO , LOG_LVL_WARN , LOG_LVL_ERROR , LOG_LVL_FATAL } |
Logging levels. More... | |
enum class | TextColor { Black , DarkRed , DarkGreen , DarkYellow , DarkBlue , DarkMagenta , DarkCyan , LightGray , DarkGray , Red , Green , Yellow , Blue , Magenta , Cyan , White } |
Text colors for console output. More... | |
enum class | LoggerParam { LastFileName , LastFilePath , LastLogTimestamp , TimeSinceLastLog } |
Enumeration for different logger parameters that can be retrieved. More... | |
Functions | |
const char * | to_c_str (const LogLevel &level, const int &mode=0) |
Convert LogLevel to a C-style string representation. | |
std::string | to_string (const LogLevel &level, const int &mode=0) |
Convert LogLevel to a std::string representation. | |
const char * | to_c_str (const TextColor &color) |
Convert TextColor to a C-style string (ANSI escape codes). | |
std::string | to_string (const TextColor &color) |
Convert TextColor to a std::string (ANSI escape codes). | |
std::string | get_log_level_color (const LogLevel &log_level) |
Get the ANSI color code associated with a log level. | |
std::vector< VariableValue > | args_to_array (std::vector< std::string >::const_iterator name_iter) |
Base case of recursion for argument conversion — when there are no more arguments. | |
template<typename T , typename... Ts> | |
std::vector< VariableValue > | args_to_array (std::vector< std::string >::const_iterator name_iter, const T &first_arg, const Ts &... args) |
Recursive function to convert arguments into an array of tuples (name, value). | |
bool | is_closing_template (crev_it_t left_it, crev_it_t right_it) |
Checks if the '>' character is the closing of a template argument list. | |
std::vector< std::string > | split_arguments (const std::string &all_names) |
Splits a string of argument names into individual names, ignoring nested templates, parentheses, and quotes. | |
std::string | format (const char *fmt,...) |
Formats a string according to the specified format. | |
std::string | format (const std::string &fmt,...) |
Formats a string according to the specified format using std::string. | |
std::string | get_exe_path () |
Retrieves the directory of the executable file. | |
std::vector< std::string > | get_list_files (const std::string &path) |
Recursively retrieves a list of all files in a directory. | |
std::string | get_file_name (const std::string &file_path) |
Extracts the file name from a full file path. | |
PathComponents | split_path (const std::string &path) |
Splits a path into its root and components. | |
std::string | make_relative (const std::string &file_path, const std::string &base_path) |
Computes the relative path from base_path to file_path. | |
bool | is_file (const std::string &path) |
Checks if a path represents a file (by checking for an extension). | |
void | create_directories (const std::string &path) |
Creates directories recursively for the given path. | |
The primary namespace for the LogIt++ library.
using logit::crev_it_t = std::string::const_reverse_iterator |
Definition at line 39 of file argument_utils.hpp.
|
strong |
|
strong |
|
strong |
|
inline |
Base case of recursion for argument conversion — when there are no more arguments.
name_iter | Iterator for the argument name list. |
Definition at line 16 of file argument_utils.hpp.
std::vector< VariableValue > logit::args_to_array | ( | std::vector< std::string >::const_iterator | name_iter, |
const T & | first_arg, | ||
const Ts &... | args ) |
Recursive function to convert arguments into an array of tuples (name, value).
T | Type of the first argument. |
Ts | Types of the remaining arguments. |
name_iter | Iterator for the argument name list. |
first_arg | The first argument. |
args | The remaining arguments. |
Definition at line 28 of file argument_utils.hpp.
void logit::create_directories | ( | const std::string & | path | ) |
Creates directories recursively for the given path.
path | The directory path to create. |
std::runtime_error | if the directories cannot be created. |
Definition at line 336 of file path_utils.hpp.
|
inline |
Formats a string according to the specified format.
This function formats a string using either the custom implementation based on vsnprintf
) or the fmt
library, depending on whether the macro LOGIT_USE_FMT_LIB
is defined.
fmt | The format string (similar to printf format). |
... | A variable number of arguments matching the format string. |
Definition at line 27 of file format.hpp.
|
inline |
Formats a string according to the specified format using std::string.
This function formats a string using either the custom implementation based on vsnprintf
) or the fmt
library, depending on whether the macro LOGIT_USE_FMT_LIB
is defined.
fmt | The format string (similar to printf format) provided as std::string. |
... | A variable number of arguments matching the format string. |
Definition at line 67 of file format.hpp.
std::string logit::get_exe_path | ( | ) |
Retrieves the directory of the executable file.
Definition at line 37 of file path_utils.hpp.
std::string logit::get_file_name | ( | const std::string & | file_path | ) |
Extracts the file name from a full file path.
file_path | The full file path as a string. |
Definition at line 178 of file path_utils.hpp.
std::vector< std::string > logit::get_list_files | ( | const std::string & | path | ) |
Recursively retrieves a list of all files in a directory.
path | The directory path to search. |
Definition at line 89 of file path_utils.hpp.
|
inline |
Checks if the '>' character is the closing of a template argument list.
left_it | Iterator pointing to the '>' character. |
right_it | Iterator pointing to the end of the string. |
Definition at line 45 of file argument_utils.hpp.
|
inline |
Checks if a path represents a file (by checking for an extension).
path | The path to check. |
Definition at line 327 of file path_utils.hpp.
std::string logit::make_relative | ( | const std::string & | file_path, |
const std::string & | base_path ) |
Computes the relative path from base_path to file_path.
file_path | The target file path. |
base_path | The base path from which to compute the relative path. |
Definition at line 273 of file path_utils.hpp.
|
inline |
Splits a string of argument names into individual names, ignoring nested templates, parentheses, and quotes.
all_names | The string containing all argument names. |
Definition at line 63 of file argument_utils.hpp.
PathComponents logit::split_path | ( | const std::string & | path | ) |
Splits a path into its root and components.
path | The path to split. |
Definition at line 229 of file path_utils.hpp.
|
inline |
|
inline |
|
inline |
|
inline |