BARE2D
Logger.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <fstream>
5 
6 namespace BARE2D {
7 
8  /**
9  * @class Logger
10  * @brief For general purpose logging, this is the logger! It is a singleton class.
11  */
12  class Logger
13  {
14  public:
15  static Logger* getInstance();
16 
17  /**
18  * @brief Logs a message to a file and the terminal
19  * @param message The message to log
20  * @param important If this is set to true, the message will be surrounded with hashes. This implies importance!
21  */
22  void log(std::string message, bool important = false);
23 
24  private:
25  Logger();
26  ~Logger();
27 
28  // The stream for the file we're going to write to.
29  std::ofstream m_logFile;
30 
31  static Logger* m_instance;
32 
33  };
34 
35 }
BARE2D::Logger::Logger
Logger()
Definition: Logger.cpp:11
BARE2D
Definition: App.cpp:13
BARE2D::Logger::getInstance
static Logger * getInstance()
Definition: Logger.cpp:34
BARE2D::Logger::log
void log(std::string message, bool important=false)
Logs a message to a file and the terminal.
Definition: Logger.cpp:42
BARE2D::Logger::~Logger
~Logger()
BARE2D::Logger::m_logFile
std::ofstream m_logFile
Definition: Logger.hpp:29
BARE2D::Logger
For general purpose logging, this is the logger! It is a singleton class.
Definition: Logger.hpp:12
BARE2D::Logger::m_instance
static Logger * m_instance
Definition: Logger.hpp:31