yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EMU_LOG_H_
2#define YAZE_APP_EMU_LOG_H_
3
4#include <iostream>
5#include <string>
6
7namespace yaze {
8namespace app {
9namespace emu {
10
11// Logger.h
12class Logger {
13 public:
14 static Logger& GetInstance() {
15 static Logger instance;
16 return instance;
17 }
18
19 void Log(const std::string& message) const {
20 // Write log messages to a file or console
21 std::cout << message << std::endl;
22 }
23
24 private:
25 Logger() = default;
26 Logger(const Logger&) = delete;
27 Logger& operator=(const Logger&) = delete;
28};
29
30// Loggable.h
31class Loggable {
32 protected:
34
35 virtual ~Loggable() = default;
36 virtual void LogMessage(const std::string& message) { logger_.Log(message); }
37};
38
39} // namespace emu
40} // namespace app
41} // namespace yaze
42
43#endif // YAZE_APP_EMU_LOG_H_
virtual void LogMessage(const std::string &message)
Definition log.h:36
virtual ~Loggable()=default
Logger & operator=(const Logger &)=delete
Logger(const Logger &)=delete
static Logger & GetInstance()
Definition log.h:14
void Log(const std::string &message) const
Definition log.h:19
Definition common.cc:21