Index: /trunk/src/cf_debug.c
===================================================================
--- /trunk/src/cf_debug.c	(revision 135)
+++ /trunk/src/cf_debug.c	(revision 136)
@@ -59,5 +59,5 @@
 } CF_DEBUG_CTX;
 
-CF_Debug_Ctx	gDebugSingleCtx = NULL;
+static CF_Debug_Ctx	gDebugSingleCtx = NULL;
 
 static int
Index: /trunk/src/cf_log.c
===================================================================
--- /trunk/src/cf_log.c	(revision 135)
+++ /trunk/src/cf_log.c	(revision 136)
@@ -37,18 +37,18 @@
 
 #define ASSERT_INIT()					\
-	if (gLogArray.ctxPool == NULL	||	\
-		gLogArray.ctxSize <= 0		)	\
+	if (gLogPool.ctxPool == NULL	||	\
+		gLogPool.poolSize <= 0		)	\
 		return CF_ERROR_LOG_NOT_INITIALIZE
 
 #define ASSERT_MAPID(__mapid)			\
-	if (gLogArray.ctxSize <= __mapid)	\
+	if (gLogPool.poolSize <= __mapid)	\
 		return CF_ERROR_LOG_INVALID_MAPID
 
 #define ASSERT_MAPPED_CTX(__mapid)			\
-	if (gLogArray.ctxPool[__mapid] != NULL)	\
+	if (gLogPool.ctxPool[__mapid] != NULL)	\
 		return CF_ERROR_LOG_ALREADY_MAPPED_ID
 
 #define ASSERT_NOT_MAPPED_CTX(__mapid)		\
-	if (gLogArray.ctxPool[__mapid] == NULL)	\
+	if (gLogPool.ctxPool[__mapid] == NULL)	\
 		return CF_ERROR_LOG_NOT_MAPPED_ID
 
@@ -87,8 +87,8 @@
 {
 	CF_Log_Ctx	* ctxPool;
-	int			ctxSize;
-} CF_LOG_ARRAY;
-
-static CF_LOG_ARRAY	gLogArray;
+	int			poolSize;
+} CF_LOG_POOL;
+
+static CF_LOG_POOL	gLogPool;
 
 #if defined(_WIN32) || defined(_WIN64)
@@ -294,24 +294,20 @@
  * \param prefix	로그의 프리픽스 문자열
  * \param fmt		포맷 스트링
- * \param ...		가변 인자
- */
-static int
-CF_Log_WriteCtx (CF_Log_Ctx	ctx,
-				 const char	* prefix,
-				 const char	* fmt,
-//				 ...)
-				 va_list	valist)
+ * \param valist	가변 인자 리스트
+ */
+static int
+CF_Log_WriteVA (CF_Log_Ctx	ctx,
+				const char	* prefix,
+				const char	* fmt,
+				va_list		valist)
 {
 #define BUF_LEN	16 * 1024
 	CF_LOG_CTX	* context = (CF_LOG_CTX *) ctx;
-//	va_list		valist;
 	char		buffer[BUF_LEN + 1] = {0x00,};
 	char		datetime[LOG_DATETIME_LENGTH + 1] = {0x00,};
 	int			length = 0;
+	int			result = 0;
 
 	ASSERT_CTX (ctx);
-
-	CF_Mutex_Lock (context->mutex);
-//	va_start (valist, fmt);
 
 	CF_Log_Local_GetTimeString (datetime);
@@ -319,10 +315,34 @@
 	vsnprintf (&buffer[length], BUF_LEN - (size_t)length, fmt, valist);
 
-	CF_Log_Local_Push (context, buffer, strlen (buffer));
-
-//	va_end (valist);
+	CF_Mutex_Lock (context->mutex);
+	result = CF_Log_Local_Push (context, buffer, strlen (buffer));
 	CF_Mutex_Unlock (context->mutex);
 
-	return CF_OK;
+	return result;
+}
+
+/**
+ * 로그 컨텍스트에 따라 로그 쓰기
+ *
+ * \return 성공 시, CF_OK; 실패 시, 오류 코드
+ *
+ * \param ctx		로그 컨텍스트
+ * \param prefix	로그의 프리픽스 문자열
+ * \param fmt		포맷 스트링
+ * \param ...		가변 인자
+ */
+int
+CF_Log_WriteCtx (CF_Log_Ctx	ctx,
+				 const char	* prefix,
+				 const char	* fmt, ...)
+{
+	int		result = 0;
+	va_list	valist;
+
+	va_start (valist, fmt);
+	result = CF_Log_WriteVA (ctx, prefix, fmt, valist);
+	va_end (valist);
+
+	return result;
 }
 
@@ -337,13 +357,14 @@
 CF_Log_FlushCtx (CF_Log_Ctx ctx)
 {
-	CF_LOG_CTX * context = (CF_LOG_CTX *) ctx;
+	CF_LOG_CTX	* context = (CF_LOG_CTX *) ctx;
+	int			result = 0;
 
 	ASSERT_CTX (ctx);
 
-	CF_Mutex_Lock (context->mutex);
 	CF_Log_Local_Flush (context);
+	result = CF_Mutex_Lock (context->mutex);
 	CF_Mutex_Unlock (context->mutex);
 
-	return CF_OK;
+	return result;
 }
 
@@ -464,5 +485,5 @@
 	ASSERT_MAPPED_CTX (mapid);
 
-	gLogArray.ctxPool[mapid] = ctx;
+	gLogPool.ctxPool[mapid] = ctx;
 
 	return CF_OK;
@@ -487,8 +508,8 @@
 	ASSERT_NOT_MAPPED_CTX (mapid);
 
-	CF_Log_DestroyCtx (gLogArray.ctxPool[mapid]);
-
-	free (gLogArray.ctxPool[mapid]);
-	gLogArray.ctxPool[mapid] = NULL;
+	CF_Log_DestroyCtx (gLogPool.ctxPool[mapid]);
+
+	free (gLogPool.ctxPool[mapid]);
+	gLogPool.ctxPool[mapid] = NULL;
 
 	return CF_OK;
@@ -511,5 +532,5 @@
 	ASSERT_NOT_MAPPED_CTX (mapid);
 
-	*ctx = gLogArray.ctxPool[mapid];
+	*ctx = gLogPool.ctxPool[mapid];
 
 	return CF_OK;
@@ -526,13 +547,13 @@
 CF_Log_Initialize (const int poolSize)
 {
-	memset (&gLogArray, 0x00, sizeof (CF_LOG_ARRAY));
+	memset (&gLogPool, 0x00, sizeof (CF_LOG_POOL));
 
 	if (poolSize > 0)
 	{
-		gLogArray.ctxPool =
+		gLogPool.ctxPool =
 			(CF_Log_Ctx *) calloc ((size_t) poolSize, sizeof (CF_Log_Ctx));
-		if (gLogArray.ctxPool == NULL)
+		if (gLogPool.ctxPool == NULL)
 			return CF_ERROR_LOG_INITIALIZE;
-		gLogArray.ctxSize = poolSize;
+		gLogPool.poolSize = poolSize;
 	}
 
@@ -550,13 +571,13 @@
 	int mapid = 0;
 
-	for (mapid = 0 ; mapid < gLogArray.ctxSize ; mapid++)
+	for (mapid = 0 ; mapid < gLogPool.poolSize ; mapid++)
 	{
 		CF_Log_UnmapCtxID (mapid);
 	}
 
-	if (gLogArray.ctxPool != NULL)
-		free (gLogArray.ctxPool);
-
-	memset (&gLogArray, 0x00, sizeof (CF_LOG_ARRAY));
+	if (gLogPool.ctxPool != NULL)
+		free (gLogPool.ctxPool);
+
+	memset (&gLogPool, 0x00, sizeof (CF_LOG_POOL));
 
 	return CF_OK;
@@ -679,5 +700,5 @@
 
 	va_start (valist, fmt);
-	result = CF_Log_WriteCtx (ctx, prefix, fmt, valist);
+	result = CF_Log_WriteVA (ctx, prefix, fmt, valist);
 	va_end (valist);
 
