Changeset bae0911 in opengl-game for logger.cpp
- Timestamp:
- May 10, 2019, 9:09:49 PM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- caa2359
- Parents:
- 155a7cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
logger.cpp
r155a7cf rbae0911 5 5 #include <cstdarg> 6 6 #include <iostream> 7 8 using namespace std;9 7 10 8 bool restart_gl_log() { … … 15 13 } 16 14 time_t now = time(NULL); 17 char* date = ctime(&now);18 fprintf(file, "GL_LOG_FILE log. local time %s\n", date );15 string date(ctime(&now)); 16 fprintf(file, "GL_LOG_FILE log. local time %s\n", date.c_str()); 19 17 fclose(file); 20 18 return true; 21 19 } 22 20 23 bool gl_log(const char*message, ...) {21 bool gl_log(const string message, ...) { 24 22 va_list argptr; 25 23 FILE* file = fopen(GL_LOG_FILE, "a"); … … 28 26 return false; 29 27 } 30 va_start(argptr, message );31 vfprintf(file, message , argptr);28 va_start(argptr, message.c_str()); 29 vfprintf(file, message.c_str(), argptr); 32 30 va_end(argptr); 33 31 fprintf(file, "\n"); … … 36 34 } 37 35 38 bool gl_log_err(const char*message, ...) {36 bool gl_log_err(const string message, ...) { 39 37 va_list argptr; 40 38 FILE* file = fopen(GL_LOG_FILE, "a"); … … 43 41 return false; 44 42 } 45 va_start(argptr, message );46 vfprintf(file, message , argptr);43 va_start(argptr, message.c_str()); 44 vfprintf(file, message.c_str(), argptr); 47 45 va_end(argptr); 48 46 fprintf(file, "\n"); 49 va_start(argptr, message );50 vfprintf(stderr, message , argptr);47 va_start(argptr, message.c_str()); 48 vfprintf(stderr, message.c_str(), argptr); 51 49 va_end(argptr); 52 50 fprintf(stderr, "\n");
Note:
See TracChangeset
for help on using the changeset viewer.