Index: .gitignore
===================================================================
--- .gitignore	(revision d9b6a1c5928db418f1226ed7e59f18eff16252df)
+++ .gitignore	(revision 98f06d94e4ffed65dd303dab65841241b3bf8d64)
@@ -5,4 +5,5 @@
 
 gl.log
+game.log
 crash.log
 
Index: TODO.txt
===================================================================
--- TODO.txt	(revision d9b6a1c5928db418f1226ed7e59f18eff16252df)
+++ TODO.txt	(revision 98f06d94e4ffed65dd303dab65841241b3bf8d64)
@@ -1,10 +1,8 @@
 TODO
 ==========
--Change the logger class to use cout instead of printf. Consider how easy variable argument support would be.
- - What I really need to do is completely refactor the logger class to return an ofstream to the logger file
-   and use streaming to send output to it. The log file can be closed in the destructor.
 -Add code to allow for resizing/maximizing the window
  - Doesn't seem to be necessary on OSX anymore, check that in works on Window and Linux, including removing
    the window title bar in fullscreen mode and bringing it back in windowed mode
+ -Update the IMGUI code in a generic way to support this as well
 -Check the book's "Printing Parameters from the GL Context" to output a bunch of OpenGL context params
 -Move some common functions into a Utils class
@@ -16,4 +14,7 @@
 -Make sure fullscreen works correctly on OSX. Check the book to see how to handle Retina Display.
 -Change all error messages to use the logger class so they get printed to the log file as well.
+-Change the logger class to use cout instead of printf. Consider how easy variable argument support would be.
+ - What I really need to do is completely refactor the logger class to return an ofstream to the logger file
+   and use streaming to send output to it. The log file can be closed in the destructor.
 
 NEW TODO
Index: logger.cpp
===================================================================
--- logger.cpp	(revision d9b6a1c5928db418f1226ed7e59f18eff16252df)
+++ logger.cpp	(revision 98f06d94e4ffed65dd303dab65841241b3bf8d64)
@@ -52,2 +52,20 @@
    return true;
 }
+
+ofstream ofs;
+
+void open_log() {
+   ofs.open(LOG_FILE, ios::out);
+
+   time_t now = time(NULL);
+   string date(ctime(&now));
+   ofs << "LOG_FILE log. local time " << date << endl;
+}
+
+ofstream& get_log() {
+   return ofs;
+}
+
+void close_log() {
+   ofs.close();
+}
Index: logger.h
===================================================================
--- logger.h	(revision d9b6a1c5928db418f1226ed7e59f18eff16252df)
+++ logger.h	(revision 98f06d94e4ffed65dd303dab65841241b3bf8d64)
@@ -3,8 +3,12 @@
 
 #include <string>
+#include <fstream>
 
 using namespace std;
 
 #define GL_LOG_FILE "gl.log"
+#define LOG_FILE "game.log"
+
+extern ofstream ofs;
 
 bool restart_gl_log();
@@ -12,3 +16,7 @@
 bool gl_log_err(const string message, ...);
 
+void open_log();
+ofstream& get_log();
+void close_log();
+
 #endif
Index: new-game.cpp
===================================================================
--- new-game.cpp	(revision d9b6a1c5928db418f1226ed7e59f18eff16252df)
+++ new-game.cpp	(revision 98f06d94e4ffed65dd303dab65841241b3bf8d64)
@@ -346,7 +346,13 @@
    gl_log("starting GLFW\n%s", glfwGetVersionString());
 
+   open_log();
+   get_log() << "starting GLFW" << endl;
+   get_log() << glfwGetVersionString() << endl;
+
    glfwSetErrorCallback(glfw_error_callback);
    if (!glfwInit()) {
       gl_log_err("ERROR: could not start GLFW3");
+      cerr << "ERROR: could not start GLFW3" << endl;
+      get_log() << "ERROR: could not start GLFW3" << endl;
       return 1;
    }
@@ -380,4 +386,6 @@
    if (!window) {
       gl_log_err("ERROR: could not open window with GLFW3");
+      cerr << "ERROR: could not open window with GLFW3" << endl;
+      get_log() << "ERROR: could not open window with GLFW3" << endl;
       glfwTerminate();
       return 1;
@@ -449,4 +457,7 @@
    gl_log("Renderer: %s", renderer);
    gl_log("Supported OpenGL version: %s", version);
+
+   get_log() << "Renderer: " << renderer << endl;
+   get_log() << "Supported OpenGL version: " << version << endl;
 
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1011,4 +1022,6 @@
    glfwTerminate();
 
+   close_log();
+
    // free memory
 
@@ -1034,4 +1047,6 @@
 void glfw_error_callback(int error, const char* description) {
    gl_log_err("GLFW ERROR: code %i msg: %s", error, description);
+   cerr << "GLFW ERROR: code " << error << " msg: " << description << endl;
+   get_log() << "GLFW ERROR: code " << error << " msg: " << description << endl;
 }
 
@@ -1275,4 +1290,6 @@
   if (!image_data) {
     gl_log_err("ERROR: could not load %s", file_name.c_str());
+    cerr << "ERROR: could not load " << file_name << endl;
+    get_log() << "ERROR: could not load " << file_name << endl;
   }
 
@@ -1280,4 +1297,6 @@
   if ((*x & (*x - 1)) != 0 || (*y & (*y - 1)) != 0) {
      gl_log_err("WARNING: texture %s is not power-of-2 dimensions", file_name.c_str());
+     cerr << "WARNING: texture " << file_name << " is not power-of-2 dimensions" << endl;
+     get_log() << "WARNING: texture " << file_name << " is not power-of-2 dimensions" << endl;
   }
 
