|
UCILoader 1.1.2
Small C++ library that allows user to connect to a chess engines via UCI protocol.
|
Factory functions for creating preconfigured loggers. More...
Functions | |
| LoggerBuilder | toNoting () |
| Create a logger that discards all messages. | |
| LoggerBuilder | toStd () |
| Create a logger that outputs to standard output. | |
| LoggerBuilder | toStderr () |
| Create a logger that outputs to standard error. | |
| LoggerBuilder | toFile (const std::string &filename) |
| Create a logger that outputs to a file. | |
| LoggerBuilder | toFile (const char *filename) |
| Create a logger that outputs to a file. | |
| LoggerBuilder | toBuffer (LogBuffer &buffer) |
| Create a logger that stores messages in abuffer. | |
| LoggerBuilder | toCallback (std::function< void(Logger::MessageDirection, const std::string &msg)> callback) |
| Create a logger that forwards all messages to a callback function. | |
| LoggerBuilder | toOstream (std::ostream &os) |
| Create a logger that outputs to an arbitrary output stream. | |
| template<class CustomLogger , typename ... args> | |
| LoggerBuilder | from (args... params) |
| Create a custom logger of the specified type. | |
Factory functions for creating preconfigured loggers.
The Loggers namespace provides factory methods for creating loggers with various output destinations. Each factory returns a LoggerBuilder that can be customized with LoggerTraits before calling build().
Factory Methods:
Usage Examples (from Examples/demo/main.cpp):
| LoggerBuilder UCILoader::Loggers::from | ( | args... | params | ) |
Create a custom logger of the specified type.
| CustomLogger | The custom logger class (must derive from Logger) |
| args | Types of constructor arguments |
| params | Constructor arguments for the custom logger |
Example:
| LoggerBuilder UCILoader::Loggers::toBuffer | ( | LogBuffer & | buffer | ) |
Create a logger that stores messages in abuffer.
This is useful for capturing a snapshot of recent messages for debugging.
| buffer | Reference to the LogBuffer to store messages in |
| LoggerBuilder UCILoader::Loggers::toCallback | ( | std::function< void(Logger::MessageDirection, const std::string &msg)> | callback | ) |
Create a logger that forwards all messages to a callback function.
This allows custom handling of log messages in your application.
| callback | Function to call for each logged message |
| LoggerBuilder UCILoader::Loggers::toFile | ( | const char * | filename | ) |
Create a logger that outputs to a file.
| filename | C-string path to the log file |
| LoggerBuilder UCILoader::Loggers::toFile | ( | const std::string & | filename | ) |
Create a logger that outputs to a file.
| filename | Path to the log file |
| LoggerBuilder UCILoader::Loggers::toNoting | ( | ) |
Create a logger that discards all messages.
| LoggerBuilder UCILoader::Loggers::toOstream | ( | std::ostream & | os | ) |
Create a logger that outputs to an arbitrary output stream.
| os | Reference to the output stream (e.g., std::cout, std::cerr, std::ofstream) |
| LoggerBuilder UCILoader::Loggers::toStd | ( | ) |
Create a logger that outputs to standard output.
| LoggerBuilder UCILoader::Loggers::toStderr | ( | ) |
Create a logger that outputs to standard error.