![]() |
MaCh3 2.2.1
Reference Guide
|
KS: Based on this https://github.com/gabime/spdlog/blob/a2b4262090fd3f005c2315dcb5be2f0f1774a005/include/spdlog/spdlog.h#L284. More...
#include <iostream>
#include <sstream>
#include <functional>
#include <string>
#include <exception>
#include "Manager/Core.h"
#include "spdlog/spdlog.h"
Go to the source code of this file.
Macros | |
#define | MACH3LOG_TRACE SPDLOG_TRACE |
#define | MACH3LOG_DEBUG SPDLOG_DEBUG |
#define | MACH3LOG_INFO SPDLOG_INFO |
#define | MACH3LOG_WARN SPDLOG_WARN |
#define | MACH3LOG_ERROR SPDLOG_ERROR |
#define | MACH3LOG_CRITICAL SPDLOG_CRITICAL |
#define | MACH3LOG_OFF SPDLOG_OFF |
Functions | |
void | SetMaCh3LoggerFormat () |
Set messaging format of the logger. | |
template<typename Func , typename LogFunc , typename... Args> | |
void | LoggerPrint (const std::string &LibName, LogFunc logFunction, Func &&func, Args &&... args) |
KS: This is bit convoluted but this is to allow redirecting cout and errors from external library into MaCh3 logger format. | |
KS: Based on this https://github.com/gabime/spdlog/blob/a2b4262090fd3f005c2315dcb5be2f0f1774a005/include/spdlog/spdlog.h#L284.
Definition in file MaCh3Logger.h.
#define MACH3LOG_CRITICAL SPDLOG_CRITICAL |
Definition at line 26 of file MaCh3Logger.h.
#define MACH3LOG_DEBUG SPDLOG_DEBUG |
Definition at line 22 of file MaCh3Logger.h.
#define MACH3LOG_ERROR SPDLOG_ERROR |
Definition at line 25 of file MaCh3Logger.h.
#define MACH3LOG_INFO SPDLOG_INFO |
Definition at line 23 of file MaCh3Logger.h.
#define MACH3LOG_OFF SPDLOG_OFF |
Definition at line 27 of file MaCh3Logger.h.
#define MACH3LOG_TRACE SPDLOG_TRACE |
Definition at line 21 of file MaCh3Logger.h.
#define MACH3LOG_WARN SPDLOG_WARN |
Definition at line 24 of file MaCh3Logger.h.
void LoggerPrint | ( | const std::string & | LibName, |
LogFunc | logFunction, | ||
Func && | func, | ||
Args &&... | args | ||
) |
KS: This is bit convoluted but this is to allow redirecting cout and errors from external library into MaCh3 logger format.
Func | The type of the function to be called, which outputs to stdout and stderr. |
LogFunc | The type of the logging function, typically a lambda that formats and logs messages. |
Args | The types of the arguments to be passed to func . |
LibName | The name of the library or component from which the log message originates. |
logFunction | The lambda function responsible for formatting and logging messages. It should accept a single const std::string& parameter. |
func | The function to be called, whose output needs to be captured and logged. |
args | The arguments to be passed to func . void ExampleFunc(int x, const std::string& str) {
std::cout << "Output from exampleFunc: " << x << ", " << str << "\n";
std::cerr << "Error from exampleFunc: " << x << ", " << str << "\n";
}
int main() {
static_cast<void(*)(int, const std::string&)>(ExampleFunc), 666, "Number of the BEAST");
return 0;
}
void LoggerPrint(const std::string &LibName, LogFunc logFunction, Func &&func, Args &&... args) KS: This is bit convoluted but this is to allow redirecting cout and errors from external library int... Definition: MaCh3Logger.h:67 |
func
into an existing logging mechanism without modifying func
itself Definition at line 67 of file MaCh3Logger.h.
|
inline |
Set messaging format of the logger.
Definition at line 30 of file MaCh3Logger.h.