/** * @file log.c * @author myusgun * @version 0.1 */ #include "cf_log.h" #include CF_Log_Ctx gLogCtx; int main (void) { int i, j; char logname[16] = {0x00,}; CF_Log_Initialize (10); // with context gLogCtx = CF_Log_CreateCtx ("log.txt", CF_LOG_BUFFER_DEFAULT); if (gLogCtx == NULL) fprintf (stderr, "create log ctx error\n"); for (i = 0 ; i < 10000 ; i++) CF_Log_Write (gLogCtx, "LOG_TEST", "turn %d\n", i); CF_Log_Write (gLogCtx, "prefix", "log test\n"); CF_Log_DestroyCtx (gLogCtx); // with id number for (i = 0 ; i < 10 ; i++) { sprintf (logname, "logid%d.txt", i); CF_LOG_OPEN (i, logname, CF_LOG_BUFFER_NO); } for (i = 0 ; i < 10 ; i++) { for (j = 0 ; j < 10000 ; j++) CF_LOG_WRITE (i, "LOG_ID_TEST", "turn %d\n", j); CF_LOG_CLOSE (i); } CF_Log_Finalize (); return 0; }