Index: /trunk/include/cf_debug.h
===================================================================
--- /trunk/include/cf_debug.h	(revision 33)
+++ /trunk/include/cf_debug.h	(revision 34)
@@ -11,4 +11,44 @@
  * 환경에 적합하도록 사용자가 구성한 컨텍스트를 이용하여 사용할 수도 있음 <br />
  * (단, 콜스택의 푸시/팝은 컨텍스트를 이용해야만 사용 가능)
+ *
+ * @section 샘플코드
+ * @code
+
+#include "cf_debug.h"
+
+CF_Debug_Ctx gDebugCtx;
+
+void callee (void) {
+	CF_Debug_CallStack callstack;
+	
+	CF_DEBUG_CALLSTACK_PUSH (gDebugCtx);
+	CF_DEBUG_CALLSTACK_POP (gDebugCtx, &callstack);
+}
+
+int main (void) {
+	int fd = 0;
+	gDebugCtx = CF_Debug_CreateCtx ();
+
+	CF_DEBUG_CALLSTACK_PUSH (gDebugCtx);
+
+	CF_DEBUG_TRACE (gDebugCtx, "print trace message with context to stderr\n");
+
+	fd = CF_File_Create ("debug.txt");
+	if (fd < 0) {
+		CF_DEBUG_PRINT (stderr, "error ...\n");
+		// error
+	}
+	CF_Debug_SetOutputFD (gDebugCtx, fd);
+
+	CF_DEBUG_TRACE (gDebugCtx, "print trace message with context to debug.txt\n");
+
+	CF_DEBUG_CALLSTACK_POP (gDebugCtx, NULL);
+
+	CF_Debug_DestroyCtx (gDebugCtx);
+
+	return 0;
+}
+
+ * @endcode
  */
 #ifndef __CF_DEBUG_H__
@@ -19,14 +59,7 @@
 #include <stdio.h>
 
-/** 잘못된 컨텍스트 오류 */
 #define CF_ERROR_DEBUG_INVALID_CTX			CF_ERROR_DEBUG - 1
-
-/** 디버그 메시지 출력을 위한 파일 포인터 설정 오류 */
 #define CF_ERROR_DEBUG_SET_OUTPUT_FD		CF_ERROR_DEBUG - 2
-
-/** 콜스택 푸시 오류 */
 #define CF_ERROR_DEBUG_PUSH_CALLSTACK		CF_ERROR_DEBUG - 3
-
-/** 콜스택 팝 오류 */
 #define CF_ERROR_DEBUG_POP_CALLSTACK		CF_ERROR_DEBUG - 4
 
Index: /trunk/include/cf_file.h
===================================================================
--- /trunk/include/cf_file.h	(revision 33)
+++ /trunk/include/cf_file.h	(revision 34)
@@ -3,4 +3,38 @@
  * @author	myusgun <myusgun@gmail.com>
  * @version	0.1
+ *
+ * @section 샘플코드
+ * @code
+
+#include "cf_file.h"
+
+int main (void) {
+	int fd = 0;
+	char *name = "file.txt";
+	char buffer[128] = {0x00,};
+
+	fd = CF_File_Create (name);
+	if (fd < 0) {
+		// error
+	}
+	if (CF_File_Write (fd, "file test", 9) < 0) {
+		// error
+	}
+	CF_File_Close (fd);
+
+	fd = CF_File_Open (name, CF_FILE_RO);
+	if (fd < 0) {
+		// error
+	}
+	printf ("file size : %d\n", CF_File_GetSize (fd));
+	if (CF_File_Read (fd, buffer, sizeof (buffer)) < 0) {
+		// error
+	}
+	CF_File_Close (fd);
+
+	return 0;
+}
+
+ * @endcode
  */
 #ifndef __CF_FILE_H__
Index: /trunk/include/cf_log.h
===================================================================
--- /trunk/include/cf_log.h	(revision 33)
+++ /trunk/include/cf_log.h	(revision 34)
@@ -3,4 +3,58 @@
  * @author	myusgun <myusgun@gmail.com>
  * @version	0.1
+ *
+ * @section 샘플코드
+ * @code
+
+#include "cf_log.h"
+
+CF_Log_Ctx gLogCtx;
+
+void main (const char * message)
+{
+	int			i, j;
+	char		logname[16] = {0x00,};
+
+	CF_DEBUG_CALLSTACK_PUSH (gDebugCtx);
+
+	CF_Log_Initialize (10);
+
+	// with context
+	gLogCtx = CF_Log_CreateCtx (file, CF_LOG_BUFFER_DEFAULT);
+	if (gLogCtx == NULL)
+		CF_DEBUG_PRINT (stderr, "create log ctx error\n");
+
+	for (i = 0 ; i < 10000 ; i++)
+		CF_Log_Write (gLogCtx, "LOG_TEST", "turn %d\n", i);
+
+	CF_DEBUG_CALLSTACK_POP (gDebugCtx, &gDebugCallstack);
+
+	CF_Log_Write (gLogCtx, message,
+							"here is the end of function [file:%s line:%d func:%s]\n",
+							gDebugCallstack.file,
+							gDebugCallstack.line,
+							gDebugCallstack.function);
+
+	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 ();
+}
+
+ * @endcode
  */
 #ifndef __CF_LOG_H__
Index: /trunk/include/cf_socket.h
===================================================================
--- /trunk/include/cf_socket.h	(revision 33)
+++ /trunk/include/cf_socket.h	(revision 34)
@@ -3,6 +3,75 @@
  * @author	myusgun <myusgun@gmail.com>
  * @version	0.1
-
+ *
  * @remark TCP 소켓만 지원됨
+ *
+ * @section 샘플코드(서버)
+ * @code
+
+#include "cf_socket.h"
+
+int main (void) {
+	int srvsock = 0;
+	int clntsock = 0;
+	short port = 12345;
+	int recvd = 0;
+	char buf[1024] = {0x00,};
+
+	if (CF_Socket_Initialize () < 0) {
+		// error
+	}
+	srvsock = CF_Socket_Server (port, 5);
+	if (srvsock < 0) {
+		// error
+	}
+	clntsock = CF_Socket_Accept (srvsock, NULL);
+	if (clntsock < 0) {
+		// error
+	}
+	if ((recvd = CF_Socket_Recv (clntsock, buf, sizeof (buf))) < 0) {
+		// error
+	}
+	if (CF_Socket_Send (clntsock, buf, recvd) < 0) {
+		// error
+	}
+	CF_Socket_Close (srvsock);
+	CF_Socket_Finalize ();
+
+	return 0;
+}
+
+ * @endcode
+ *
+ * @section 샘플코드(클라이언트)
+ * @code
+
+#include "cf_socket.h"
+
+int main (void) {
+	int sock = 0;
+	int recvd = 0;
+	char buf[1024] = {0x00,};
+	short port = 12345;
+
+	if (CF_Socket_Initialize () < 0) {
+		// error
+	}
+	sock = CF_Socket_Connect ("localhost", port);
+	if (sock < 0) {
+		// error
+	}
+	if (CF_Socket_Send (sock, buf, sizeof (buf)) < 0) {
+		// error
+	}
+	if ((recvd = CF_Socket_Recv (sock, buf, sizeof (buf))) < 0) {
+		// error
+	}
+	CF_Socket_Close (sock);
+	CF_Socket_Finalize ();
+
+	return 0;
+}
+
+ * @endcode
  */
 #ifndef __CF_SOCKET_H__
Index: /trunk/include/cf_thread.h
===================================================================
--- /trunk/include/cf_thread.h	(revision 33)
+++ /trunk/include/cf_thread.h	(revision 34)
@@ -5,4 +5,49 @@
  *
  * @remark 멀티스레드 및 뮤텍스 지원
+ *
+ * @section 샘플코드
+ * @code
+
+#include "cf_thread.h"
+
+CF_Mutex globalMutex;
+
+CF_THREAD_RETURN CF_THREAD_CALL worker (void * arg) {
+	if (CF_Mutex_Create (&globalMutex) < 0) {
+		// error
+	}
+
+	if (CF_Mutex_Lock (&globalMutex) < 0) { // for critical section
+		// error
+	}
+
+	// critical section
+
+	if (CF_Mutex_Unlock (&globalMutex) < 0) { // for critical section
+		// error
+	}
+
+	if (CF_Mutex_Destory (&globalMutex) < 0) {
+		// error
+	}
+}
+
+int main (void) {
+	CF_Thread tid;
+	if (CF_Thread_Create (&tid, worker, NULL) < 0) {
+		// error
+	}
+
+	if (CF_Thread_Join (&tid) < 0) { // block
+		// error
+	}
+
+	if (CF_Thread_Release (&tid) < 0) {
+		// error
+	}
+	return 0;
+}
+
+ * @endcode
  */
 #ifndef __CF_THREAD_H__
@@ -46,47 +91,4 @@
  * @param callback	스레드 워커 함수 이름
  * @param arg		스레드 함수로 전달할 인자
- *
- * @code
-
-#include "cf_thread.h"
-
-CF_Mutex globalMutex;
-
-CF_THREAD_RETURN CF_THREAD_CALL worker (void * arg) {
-	if (CF_Mutex_Create (&globalMutex) < 0) {
-		// error
-	}
-
-	if (CF_Mutex_Lock (&globalMutex) < 0) { // for critical section
-		// error
-	}
-
-	// critical section
-
-	if (CF_Mutex_Unlock (&globalMutex) < 0) { // for critical section
-		// error
-	}
-
-	if (CF_Mutex_Destory (&globalMutex) < 0) {
-		// error
-	}
-}
-
-int main (void) {
-	CF_Thread tid;
-	if (CF_Thread_Create (&tid, worker, NULL) < 0) {
-		// error
-	}
-
-	if (CF_Thread_Join (&tid) < 0) { // block
-		// error
-	}
-
-	if (CF_Thread_Release (&tid) < 0) {
-		// error
-	}
-}
-
- * @endcode
  */
 CF_EXPORT int
Index: /trunk/src/cf_debug.c
===================================================================
--- /trunk/src/cf_debug.c	(revision 33)
+++ /trunk/src/cf_debug.c	(revision 34)
@@ -169,5 +169,5 @@
 		}
 
-		fp = fdopen (dupfd, "a+");
+		fp = fdopen (dupfd, "a");
 		if (fp == NULL)
 		{
Index: /trunk/src/cf_log.c
===================================================================
--- /trunk/src/cf_log.c	(revision 33)
+++ /trunk/src/cf_log.c	(revision 34)
@@ -37,4 +37,6 @@
 #define CF_LOG_BUFFER_DEFAULT_SIZE		128 * 1024
 
+#define CF_LOG_DATETIME_LENGTH			sizeof ("0000-00-00 00:00:00.000") - 1
+
 typedef struct __cf_util_datetime__
 {
@@ -150,7 +152,5 @@
 	CF_Log_Local_GetTime (&dt);
 
-	
-
-	snprintf (buffer, strlen ("0000-00-00 00:00:00.000"),
+	snprintf (buffer, CF_LOG_DATETIME_LENGTH,
 			  "%02d-%02d-%02d %02d:%02d:%02d.%03d",
 			  dt.year, dt.month, dt.day,
@@ -336,4 +336,5 @@
 	va_list		valist;
 	char		buffer[4096] = {0x00,};
+	char		datetime[CF_LOG_DATETIME_LENGTH + 1] = {0x00,};
 	size_t		length = 0;
 
@@ -344,7 +345,6 @@
 	va_start (valist, fmt);
 
-	strncat (buffer, "[", 1);
-	CF_Log_Local_GetTimeString (buffer + strlen (buffer));
-	sprintf (buffer + strlen (buffer), "][%s] ", prefix);
+	CF_Log_Local_GetTimeString (datetime);
+	sprintf (buffer, "[%s][%s] ", datetime, prefix);
 	vsprintf (buffer + strlen (buffer), fmt, valist);
 
