Last change
on this file since 40 was 40, checked in by cheese, 11 years ago |
#1 change interface of log from context to id-number
|
File size:
797 bytes
|
Rev | Line | |
---|
[35] | 1 | /**
|
---|
| 2 | * @file log.c
|
---|
| 3 | * @author myusgun <myusgun@gmail.com>
|
---|
| 4 | * @version 0.1
|
---|
| 5 | */
|
---|
| 6 | #include "cf_log.h"
|
---|
| 7 | #include <stdio.h>
|
---|
| 8 |
|
---|
[40] | 9 | #define LOGID 1
|
---|
[35] | 10 |
|
---|
| 11 | int main (void)
|
---|
| 12 | {
|
---|
| 13 | int i, j;
|
---|
| 14 | char logname[16] = {0x00,};
|
---|
| 15 |
|
---|
[40] | 16 | if (CF_Log_Initialize (10) < 0)
|
---|
| 17 | {
|
---|
| 18 | fprintf (stderr, "failed to init. log\n");
|
---|
| 19 | return -1;
|
---|
| 20 | }
|
---|
[35] | 21 |
|
---|
| 22 | for (i = 0 ; i < 10 ; i++)
|
---|
| 23 | {
|
---|
| 24 | sprintf (logname, "logid%d.txt", i);
|
---|
[40] | 25 | if (CF_Log_Open (i, logname, CF_LOG_BUFFER_NO) < 0)
|
---|
| 26 | fprintf (stderr, "failed to open log\n");
|
---|
[35] | 27 | }
|
---|
| 28 |
|
---|
| 29 | for (i = 0 ; i < 10 ; i++)
|
---|
| 30 | {
|
---|
| 31 | for (j = 0 ; j < 10000 ; j++)
|
---|
[40] | 32 | {
|
---|
| 33 | int result = CF_Log_Write (i, "LOG_ID_TEST", "turn %d\n", j);
|
---|
| 34 | if (result < 0)
|
---|
| 35 | fprintf (stderr, "failed to write log %d\n", result);
|
---|
| 36 | }
|
---|
[35] | 37 |
|
---|
[40] | 38 | if (CF_Log_Close (i) < 0)
|
---|
| 39 | fprintf (stderr, "failed to close log\n");
|
---|
[35] | 40 | }
|
---|
| 41 |
|
---|
| 42 | CF_Log_Finalize ();
|
---|
| 43 |
|
---|
| 44 | return 0;
|
---|
| 45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.