mrDIMAS

Untitled

Apr 15th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. // Precompiled.h
  2. constexpr char LineEnd = '\n';
  3. class LogImpl {
  4. private:
  5.     ofstream mFile;
  6. public:
  7.     ///////////////////////////////////////////////////////////////////////////////
  8.     LogImpl() : mFile("dwarf.log") {}
  9.  
  10.     ///////////////////////////////////////////////////////////////////////////////
  11.     ~LogImpl() {}
  12.  
  13.     ///////////////////////////////////////////////////////////////////////////////
  14.     template<class T>
  15.     inline LogImpl & operator << (const T & value) {
  16.         mFile << value;
  17.         cout << value;
  18.         return *this;
  19.     }
  20. };
  21. LogImpl & Log();
  22.  
  23.  
  24. // Log.cpp
  25. LogImpl & Log() {
  26.     static LogImpl log;
  27.     return log;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment