source: libcf/trunk/test/log.c@ 103

Last change on this file since 103 was 103, checked in by cheese, 11 years ago

#1 fix some symbol names, test code and exception handling logic

File size: 780 bytes
Line 
1/**
2 * @file log.c
3 * @author myusgun <myusgun@gmail.com>
4 */
5#include "cf_log.h"
6#include <stdio.h>
7
8int main (void)
9{
10 int i, j;
11 char logname[16] = {0x00,};
12
13 if (CF_Log_Initialize (10, CF_LOG_NO_LEVEL) < 0)
14 {
15 fprintf (stderr, "failed to init. log\n");
16 return -1;
17 }
18
19 for (i = 0 ; i < 10 ; i++)
20 {
21 sprintf (logname, "logid%d.txt", i);
22 if (CF_Log_Open (i, logname, CF_LOG_NO_BUFFER) < 0)
23 fprintf (stderr, "failed to open log\n");
24 }
25
26 for (i = 0 ; i < 10 ; i++)
27 {
28 for (j = 0 ; j < 10000 ; j++)
29 {
30 int result = CF_Log_Write (i, "LOG_ID_TEST", "turn %d\n", j);
31 if (result < 0)
32 fprintf (stderr, "failed to write log %d\n", result);
33 }
34
35 if (CF_Log_Close (i) < 0)
36 fprintf (stderr, "failed to close log\n");
37 }
38
39 CF_Log_Finalize ();
40
41 return 0;
42}
Note: See TracBrowser for help on using the repository browser.