diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-04-16 06:22:51 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-04-16 06:22:51 +0000 |
| commit | 8139fbf8204882663446bcb06f68789353597820 (patch) | |
| tree | 6ea1f39932b33faee84d603e956470e37f135804 /plugins/dfOpenGL/gllog.c | |
| download | pcsxr-8139fbf8204882663446bcb06f68789353597820.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@23061 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins/dfOpenGL/gllog.c')
| -rw-r--r-- | plugins/dfOpenGL/gllog.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/dfOpenGL/gllog.c b/plugins/dfOpenGL/gllog.c new file mode 100644 index 00000000..447b05a5 --- /dev/null +++ b/plugins/dfOpenGL/gllog.c @@ -0,0 +1,43 @@ +// comment next line and all gllog(xx,....) will go to gpulog.txt (enable logging) +#define _COMMENTLOG + +void gllog(int level, char *fmt,...) +{ +#ifndef _COMMENTLOG + static FILE *out=NULL; + static char tmpbuf[200], tmpbufold[200]; + + static int repeatcount=0; + + if(out==NULL) + { + // open output file ! + if((out=fopen("gpulog.txt","wb"))==NULL)exit(1); + } + // file already opened + + va_list marker; + va_start(marker,fmt); + vsprintf(tmpbuf, fmt, marker ); + va_end(marker); + + // we dont log the same line multiple times + if(strcmp(tmpbufold,tmpbuf)==0) + { + repeatcount++; + return; + } + else + { + // copy the new line to the old buffer + strcpy(tmpbufold,tmpbuf); + if(repeatcount>0) + { + fprintf(out,"Last message repeated %d times\n",repeatcount); + repeatcount=0; + } + fprintf(out,"Level: %d msg: %s\n",level,tmpbuf); + fflush(out); + } +#endif +} |
