Grail (C++)  1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Sink.hh
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_SINK_H
4 #define GRAIL_SINK_H
5 
6 #include <memory>
7 #include <mutex>
8 
9 #include "Severity.h"
10 
11 namespace grail
12 {
13 namespace logger
14 {
18  class Sink
19  {
20  public:
21  Sink(bool isSynchronized = false);
22 
23  Sink(const Sink& other) = delete;
24  Sink(Sink&& other) = delete;
25 
26  virtual ~Sink() = default;
27 
28  Sink& operator =(const Sink& other) = delete;
29  Sink& operator =(Sink&& other) = delete;
30 
31  void Sync(const std::string& loggerName,
32  Severity severity,
33  const std::string& message,
34  const std::string& logFileLocation,
35  const std::size_t& logLineNumber);
36 
37  protected:
46  virtual void Log(const std::string& loggerName,
47  Severity severity,
48  const std::string& message,
49  const std::string& logFileLocation,
50  const std::size_t& logLineNumber) = 0;
51 
52  private:
53  const bool isSynchronized{false};
54  std::mutex mutex{};
55  };
56 }
57 }
58 
59 #endif // GRAIL_SINK_H
grail::logger::Sink::Log
virtual void Log(const std::string &loggerName, Severity severity, const std::string &message, const std::string &logFileLocation, const std::size_t &logLineNumber)=0
Log - override this method to define how the messege should be logged.
grail::logger::Sink
The Sink class - destination of logger messages.
Definition: Sink.hh:18