Last change
on this file since 35 was 35, checked in by cheese, 11 years ago |
#1 separate example code and doxygen comment and fix logging push logic by vfire
|
File size:
798 bytes
|
Rev | Line | |
---|
[35] | 1 | /**
|
---|
| 2 | * @file debug.c
|
---|
| 3 | * @author myusgun <myusgun@gmail.com>
|
---|
| 4 | * @version 0.1
|
---|
| 5 | */
|
---|
| 6 | #include "cf_file.h"
|
---|
| 7 | #include "cf_debug.h"
|
---|
| 8 |
|
---|
| 9 | CF_Debug_Ctx gDebugCtx;
|
---|
| 10 |
|
---|
| 11 | void callee (void) {
|
---|
| 12 | CF_Debug_CallStack callstack;
|
---|
| 13 |
|
---|
| 14 | CF_DEBUG_CALLSTACK_PUSH (gDebugCtx);
|
---|
| 15 | CF_DEBUG_CALLSTACK_POP (gDebugCtx, &callstack);
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | int main (void) {
|
---|
| 19 | int fd = 0;
|
---|
| 20 | gDebugCtx = CF_Debug_CreateCtx ();
|
---|
| 21 |
|
---|
| 22 | CF_DEBUG_CALLSTACK_PUSH (gDebugCtx);
|
---|
| 23 |
|
---|
| 24 | CF_DEBUG_TRACE (gDebugCtx, "print trace message with context to stderr\n");
|
---|
| 25 |
|
---|
| 26 | fd = CF_File_Create ("debug.txt");
|
---|
| 27 | if (fd < 0) {
|
---|
| 28 | CF_DEBUG_PRINT (stderr, "error ...\n");
|
---|
| 29 | // error
|
---|
| 30 | }
|
---|
| 31 | CF_Debug_SetOutputFD (gDebugCtx, fd);
|
---|
| 32 |
|
---|
| 33 | CF_DEBUG_TRACE (gDebugCtx, "print trace message with context to debug.txt\n");
|
---|
| 34 |
|
---|
| 35 | CF_DEBUG_CALLSTACK_POP (gDebugCtx, NULL);
|
---|
| 36 |
|
---|
| 37 | CF_Debug_DestroyCtx (gDebugCtx);
|
---|
| 38 |
|
---|
| 39 | return 0;
|
---|
| 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.