/[pcsx2_0.9.7]/trunk/plugins/zzogl-pg/opengl/ZZLog.cpp
ViewVC logotype

Diff of /trunk/plugins/zzogl-pg/opengl/ZZLog.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 62 by william, Tue Sep 7 11:08:22 2010 UTC revision 191 by william, Mon Sep 20 05:35:51 2010 UTC
# Line 34  bool IsLogging() Line 34  bool IsLogging()
34          return (gsLog != NULL && conf.log);          return (gsLog != NULL && conf.log);
35  }  }
36    
37  bool Open()  void Open()
38  {  {
     bool result = true;  
39      const std::string LogFile(s_strLogPath + "GSzzogl.log");      const std::string LogFile(s_strLogPath + "GSzzogl.log");
40    
41      gsLog = fopen(LogFile.c_str(), "w");      gsLog = fopen(LogFile.c_str(), "w");
42      if (gsLog != NULL)      if (gsLog != NULL)
43          setvbuf(gsLog, NULL,  _IONBF, 0);          setvbuf(gsLog, NULL,  _IONBF, 0);
44      else      else
     {  
45          SysMessage("Can't create log file %s\n", LogFile.c_str());          SysMessage("Can't create log file %s\n", LogFile.c_str());
         result = false;  
     }  
46    
     return result;  
47  }  }
48    
49  void Close()  void Close()
# Line 64  void SetDir(const char* dir) Line 59  void SetDir(const char* dir)
59          // Get the path to the log directory.          // Get the path to the log directory.
60          s_strLogPath = (dir==NULL) ? "logs/" : dir;          s_strLogPath = (dir==NULL) ? "logs/" : dir;
61    
62          // Reload the log file after updated the path          // Reload previously open log file
63      Close();      if (gsLog) {
64          Open();          Close();
65            Open();
66        }
67  }  }
68    
69  void WriteToScreen(const char* pstr, u32 ms)  void WriteToScreen(const char* pstr, u32 ms)
# Line 167  void Greg_Log(const char *fmt, ...) Line 164  void Greg_Log(const char *fmt, ...)
164    
165          va_start(list, fmt);          va_start(list, fmt);
166    
167          fprintf(gsLog, "GRegs: ");          if (IsLogging()) {
168            fprintf(gsLog, "GRegs: ");
169            vfprintf(gsLog, fmt, list);
170        }
171          //fprintf(stderr,"GRegs: ");          //fprintf(stderr,"GRegs: ");
         if (IsLogging()) vfprintf(gsLog, fmt, list);  
172          //vfprintf(stderr, fmt, list);          //vfprintf(stderr, fmt, list);
173    
174          va_end(list);          va_end(list);

Legend:
Removed from v.62  
changed lines
  Added in v.191

  ViewVC Help
Powered by ViewVC 1.1.22