Simple C++ logger by using singleton pattern

前端 未结 4 1922
旧巷少年郎
旧巷少年郎 2021-02-09 17:28

Due to the flooding examples of implementing logger using Singleton pattern, I have just written a simple C++ logger in the same approach for my program. However, since the famo

4条回答
  •  既然无缘
    2021-02-09 17:58

    You do not really need separate Initialize() function as this will just contaminate your singleton interface. Just get singleton instance

    VERIFY(NULL != Logger::Instance()); 
    

    before any other thread has chance to access it.

提交回复
热议问题