![]() |
Shamrock 2025.10.0
Astrophysical Code
|
Namespace containing logs utils. More...
Classes | |
| struct | ReformatArgs |
| A structure containing the arguments to a log formatter. More... | |
Typedefs | |
| using | reformat_func_ptr = std::string(*)(const ReformatArgs &args) |
| A pointer to a log formatter function. | |
Functions | |
| void | set_loglevel (i8 val) |
| Set the global log level. | |
| i8 | get_loglevel () |
| Get the current global log level. | |
| std::string | format_message () |
| Formats an empty log message. | |
| template<typename T , typename... Types> | |
| std::string | format_message (T var1, Types... var2) |
| Formats a log message with multiple arguments. | |
| template<typename... Types> | |
| std::string | format_message (std::string s, Types... var2) |
| void | print () |
| Prints a log message with no arguments. | |
| template<typename T , typename... Types> | |
| void | print (T var1, Types... var2) |
| Prints a log message with multiple arguments. | |
| void | print_ln () |
| Prints a log message with multiple arguments followed by a newline. | |
| template<typename T , typename... Types> | |
| void | print_ln (T var1, Types... var2) |
| Prints a log message with multiple arguments followed by a newline. | |
| void | change_formaters (reformat_func_ptr full, reformat_func_ptr simple) |
| Changes the log formatter functions. | |
| std::string | reformat_all (const std::string &color, const char *name, const std::string &module_name, const std::string &content) |
| Format a log message with all the information. | |
| std::string | reformat_simple (const std::string &color, const char *name, const std::string &module_name, const std::string &content) |
| Format a log message with the minimum information. | |
Variables | |
| reformat_func_ptr | _reformat_all = nullptr |
| Pointer to the full formatter function. | |
| reformat_func_ptr | _reformat_simple = nullptr |
| Pointer to the simple formatter function. | |
Namespace containing logs utils.
| using shambase::logs::reformat_func_ptr = typedef std::string (*)(const ReformatArgs &args) |
A pointer to a log formatter function.
This is a pointer to a function that takes a ReformatArgs structure and returns a string containing the formatted log message. It is used to pass a log formatter function to the change_formaters function.
Definition at line 71 of file reformat_message.hpp.
| void shambase::logs::change_formaters | ( | reformat_func_ptr | full, |
| reformat_func_ptr | simple | ||
| ) |
Changes the log formatter functions.
This function is used to change the log formatter functions used by the shamcomm::logs module. It takes two reformat_func_ptr arguments: the first is the full formatter function, and the second is the simple formatter function.
| full | The full formatter function |
| simple | The simple formatter function |
Definition at line 38 of file reformat_message.cpp.
Here is the call graph for this function:
|
inline |
Formats an empty log message.
This function is used to format log messages when there are no additional arguments to be passed.
Definition at line 37 of file msgformat.hpp.
|
inline |
Formats a log message by concatenating a string with additional arguments.
| s | The initial string to be formatted |
| var2 | Additional arguments to be formatted and appended to the string |
Definition at line 60 of file msgformat.hpp.
Here is the call graph for this function:
|
inline |
Formats a log message with multiple arguments.
Formats a log message with multiple arguments.
| var1 | The first argument to be formatted in the log message. |
| var2 | The remaining arguments to be formatted in the log message. |
This function is a variadic template that recursively formats a log message by concatenating the string representation of each argument passed to it.
| T | The type of the first argument |
| Types | The types of the remaining arguments |
Definition at line 77 of file msgformat.hpp.
Here is the call graph for this function:
|
inline |
Get the current global log level.
Definition at line 52 of file loglevel.hpp.
|
inline |
Prints a log message with no arguments.
This function is a specialization of the variadic template print that does nothing. It is used to terminate the recursion when there are no more arguments to format.
Definition at line 37 of file printer_base.hpp.
Prints a log message with multiple arguments.
This function is a variadic template that recursively prints a log message by formatting each argument and concatenating them. It uses the shambase::print function to output the formatted message.
| T | The type of the first argument |
| Types | The types of the remaining arguments |
| var1 | The first argument to be printed in the log message. |
| var2 | The remaining arguments to be printed in the log message. |
Definition at line 53 of file printer_base.hpp.
Here is the call graph for this function:
|
inline |
Prints a log message with multiple arguments followed by a newline.
This function is a specialization of the variadic template print_ln that does nothing. It is used to terminate the recursion when there are no more arguments to format.
Definition at line 64 of file printer_base.hpp.
Prints a log message with multiple arguments followed by a newline.
This function is a variadic template that recursively prints a log message by formatting each argument and concatenating them. It uses the shambase::println function to output the formatted message, followed by a newline.
| T | The type of the first argument |
| Types | The types of the remaining arguments |
| var1 | The first argument to be printed in the log message. |
| var2 | The remaining arguments to be printed in the log message. |
Definition at line 81 of file printer_base.hpp.
Here is the call graph for this function:| std::string shambase::logs::reformat_all | ( | const std::string & | color, |
| const char * | name, | ||
| const std::string & | module_name, | ||
| const std::string & | content | ||
| ) |
Format a log message with all the information.
| color | The color of the log message |
| name | The name of the logger |
| module_name | The name of the module |
| content | The content of the log message |
Definition at line 51 of file reformat_message.cpp.
| std::string shambase::logs::reformat_simple | ( | const std::string & | color, |
| const char * | name, | ||
| const std::string & | module_name, | ||
| const std::string & | content | ||
| ) |
Format a log message with the minimum information.
| color | The color of the log message |
| name | The name of the logger |
| module_name | The name of the module |
| content | The content of the log message |
Definition at line 73 of file reformat_message.cpp.
Set the global log level.
| val | The new log level |
Definition at line 45 of file loglevel.hpp.
| reformat_func_ptr shambase::logs::_reformat_all = nullptr |
Pointer to the full formatter function.
If this pointer is equal to nullptr, the default full formatter function will be used.
Definition at line 28 of file reformat_message.cpp.
| reformat_func_ptr shambase::logs::_reformat_simple = nullptr |
Pointer to the simple formatter function.
If this pointer is equal to nullptr, the default simple formatter function will be used.
Definition at line 36 of file reformat_message.cpp.