Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Logging.cpp
Go to the documentation of this file.
2 #include <iostream>
3 #include <iomanip>
4 #include <ctime>
5 #include <fstream>
6 #ifdef COUT_LOGGING
7 #include <iostream>
8 #endif
9 
10 std::ofstream log_file;
11 
12 void doDebug(eastl::string Type, eastl::string debugClass, eastl::string function, eastl::string value)
13 {
14  if (log_file.is_open() == false)
15  {
16  log_file.open(log_path);
17  log_file.clear();
18  }
19 
20  //get time
21  struct tm buff;
22  time_t ltime = time(nullptr);
23 
24  //prepare string buffer
25  char str[26];
26 
27  //convert time to string
28  localtime_s(&buff, &ltime);
29  asctime_s(str, sizeof str, &buff);
30 
31  //pass on time string
32  eastl::string timeString = eastl::string(str).substr(0, 24);
33  eastl::string logString = "[" + timeString + "] " + Type + " [" + debugClass + "::" + function + "]: " + value + "\n";
34  log_file << logString.c_str();
35 #ifdef COUT_LOGGING
36  std::cout << logString.c_str() << std::endl;
37 #endif
38 }
void doDebug(eastl::string Type, eastl::string debugClass, eastl::string function, eastl::string value)
Definition: Logging.cpp:12
std::ofstream log_file
Definition: Logging.cpp:10
#define log_path
Definition: Logging.hpp:14