Last active
November 29, 2021 20:14
-
-
Save anddam/5bb3b322f74a13ff8d809ba01f745a63 to your computer and use it in GitHub Desktop.
C++ logger class excerpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Logger * Logger::m_Instance = 0; | |
Logger::Logger() { | |
char* buf = nullptr; | |
size_t sz = 0, l = 0; | |
// No `m_Instance` declared here | |
Logger * Logger::getInstance() throw () { | |
if (m_Instance == 0) { | |
m_Instance = new Logger(); | |
} | |
return m_Instance; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Logger { | |
public: | |
static Logger * getInstance() throw (); | |
private: | |
static Logger * m_Instance; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment