Changeset 34 in libcf for trunk/include/cf_log.h


Ignore:
Timestamp:
02/05/13 11:26:59 (11 years ago)
Author:
cheese
Message:

#1 add example code for doxygen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/cf_log.h

    r26 r34  
    33 * @author  myusgun <myusgun@gmail.com>
    44 * @version 0.1
     5 *
     6 * @section 샘플코드
     7 * @code
     8
     9#include "cf_log.h"
     10
     11CF_Log_Ctx gLogCtx;
     12
     13void main (const char * message)
     14{
     15    int         i, j;
     16    char        logname[16] = {0x00,};
     17
     18    CF_DEBUG_CALLSTACK_PUSH (gDebugCtx);
     19
     20    CF_Log_Initialize (10);
     21
     22    // with context
     23    gLogCtx = CF_Log_CreateCtx (file, CF_LOG_BUFFER_DEFAULT);
     24    if (gLogCtx == NULL)
     25        CF_DEBUG_PRINT (stderr, "create log ctx error\n");
     26
     27    for (i = 0 ; i < 10000 ; i++)
     28        CF_Log_Write (gLogCtx, "LOG_TEST", "turn %d\n", i);
     29
     30    CF_DEBUG_CALLSTACK_POP (gDebugCtx, &gDebugCallstack);
     31
     32    CF_Log_Write (gLogCtx, message,
     33                            "here is the end of function [file:%s line:%d func:%s]\n",
     34                            gDebugCallstack.file,
     35                            gDebugCallstack.line,
     36                            gDebugCallstack.function);
     37
     38    CF_Log_DestroyCtx (gLogCtx);
     39
     40    // with id number
     41    for (i = 0 ; i < 10 ; i++)
     42    {
     43        sprintf (logname, "logid%d.txt", i);
     44        CF_LOG_OPEN (i, logname, CF_LOG_BUFFER_NO);
     45    }
     46
     47    for (i = 0 ; i < 10 ; i++)
     48    {
     49        for (j = 0 ; j < 10000 ; j++)
     50            CF_LOG_WRITE (i, "LOG_ID_TEST", "turn %d\n", j);
     51
     52        CF_LOG_CLOSE (i);
     53    }
     54
     55    CF_Log_Finalize ();
     56}
     57
     58 * @endcode
    559 */
    660#ifndef __CF_LOG_H__
Note: See TracChangeset for help on using the changeset viewer.