added logging module and a sandbox project

This commit is contained in:
Sascha Kühl
2025-07-03 16:13:58 +02:00
parent c4a00f19fd
commit 20d6a77275
29 changed files with 2287 additions and 25 deletions
+47
View File
@@ -0,0 +1,47 @@
#ifndef MATADOR_LOG_SINK_HPP
#define MATADOR_LOG_SINK_HPP
#include <memory>
namespace matador::logger {
/**
* @brief Base class for all log sinks
*
* This class must be the base class for all
* log sinks and provides their interface
*
* The main interface is the write() interface
* defining how the log message is written.
*
* The close() interface defines a way to close
* the concrete log sink
*/
class log_sink
{
public:
/**
* Destroys the log sink
*/
virtual ~log_sink() = default;
/**
* Writes the given log message with the given size
* to the concrete sink
*
* @param message The message to log
* @param size The size of the message
*/
virtual void write(const char *message, std::size_t size) = 0;
/**
* Closes the log sink if necessary.
*/
virtual void close() = 0;
};
using sink_ptr = std::shared_ptr<log_sink>; /**< Shortcut to the log sink shared pointer */
}
#endif //MATADOR_LOG_SINK_HPP