Guest User

Log.h - 4773n0x

a guest
Dec 12th, 2016
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <fstream>
  4. #include <string>
  5. #include <memory>
  6. #include <shared_mutex>
  7.  
  8. enum class LogType
  9. {
  10.     Info,
  11.     Warning,
  12.     Error,
  13.     Debug
  14. };
  15.  
  16. class CLog
  17. {
  18. public:
  19.     void Initialize(const std::string& Path);
  20.     void Write(const std::string& Text, LogType Type);
  21.  
  22. private:
  23.     std::string TypeToString(LogType Type);
  24.  
  25.     std::shared_timed_mutex WriteMutex;
  26.     std::ofstream File;
  27. };
  28.  
  29. extern std::unique_ptr<CLog> Log;
Advertisement
Add Comment
Please, Sign In to add comment