added logging module and a sandbox project
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user