diff --git a/demo/os/linux/easylogger/inc/elog_cfg.h b/demo/os/linux/easylogger/inc/elog_cfg.h index 094558c..c1c0d28 100644 --- a/demo/os/linux/easylogger/inc/elog_cfg.h +++ b/demo/os/linux/easylogger/inc/elog_cfg.h @@ -31,10 +31,12 @@ /* enable log output. default open this macro */ #define ELOG_OUTPUT_ENABLE +/* enable terminal output. default open this macro */ +#define ELOG_TERMINAL_ENABLE /* enable log write file. default open this macro */ #define ELOG_FILE_ENABLE /* enable flush file cache. default open this macro */ -#define ELOG_FILE_FLUSH_CAHCE_ENABLE +#define ELOG_FILE_FLUSH_CACHE_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE /* enable assert check */ @@ -58,7 +60,7 @@ /* the highest output level for async mode, other level will sync output */ #define ELOG_ASYNC_OUTPUT_LVL ELOG_LVL_DEBUG /* buffer size for asynchronous output mode */ -#define ELOG_ASYNC_OUTPUT_BUF_SIZE (ELOG_LINE_BUF_SIZE * 100) +#define ELOG_ASYNC_OUTPUT_BUF_SIZE (ELOG_LINE_BUF_SIZE * 50) /* each asynchronous output's log which must end with newline sign */ //#define ELOG_ASYNC_LINE_OUTPUT /* asynchronous output mode using POSIX pthread implementation */ diff --git a/demo/os/linux/easylogger/port/elog_port.c b/demo/os/linux/easylogger/port/elog_port.c index e81d6b6..d36284e 100755 --- a/demo/os/linux/easylogger/port/elog_port.c +++ b/demo/os/linux/easylogger/port/elog_port.c @@ -75,7 +75,10 @@ void elog_port_deinit(void) { */ void elog_port_output(const char *log, size_t size) { /* output to terminal */ +#ifdef ELOG_TERMINAL_ENABLE printf("%.*s", (int)size, log); +#endif + #ifdef ELOG_FILE_ENABLE /* write the file */ elog_file_write(log, size); diff --git a/demo/os/windows/easylogger/inc/elog_cfg.h b/demo/os/windows/easylogger/inc/elog_cfg.h index de2b31a..653f4be 100644 --- a/demo/os/windows/easylogger/inc/elog_cfg.h +++ b/demo/os/windows/easylogger/inc/elog_cfg.h @@ -34,7 +34,7 @@ /* enable log write file. default open this macro */ #define ELOG_FILE_ENABLE /* enable flush file cache. default open this macro */ -#define ELOG_FILE_FLUSH_CAHCE_ENABLE +#define ELOG_FILE_FLUSH_CACHE_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE /* enable assert check */ diff --git a/easylogger/plugins/file/elog_file.c b/easylogger/plugins/file/elog_file.c index 397a295..efc3905 100755 --- a/easylogger/plugins/file/elog_file.c +++ b/easylogger/plugins/file/elog_file.c @@ -131,7 +131,7 @@ void elog_file_write(const char *log, size_t size) fwrite(log, size, 1, fp); -#ifdef ELOG_FILE_FLUSH_CAHCE_ENABLE +#ifdef ELOG_FILE_FLUSH_CACHE_ENABLE fflush(fp); #endif diff --git a/easylogger/src/elog_async.c b/easylogger/src/elog_async.c index 4754279..a8b7e2f 100755 --- a/easylogger/src/elog_async.c +++ b/easylogger/src/elog_async.c @@ -47,16 +47,22 @@ #define ELOG_ASYNC_OUTPUT_PTHREAD_PRIORITY (sched_get_priority_max(SCHED_RR) - 1) #endif /* output thread poll get log buffer size */ +#ifndef ELOG_ASYNC_LINE_OUTPUT +#ifndef ELOG_ASYNC_POLL_GET_LOG_BUF_SIZE +#define ELOG_ASYNC_POLL_GET_LOG_BUF_SIZE (ELOG_ASYNC_OUTPUT_BUF_SIZE - 4) +#endif +#else #ifndef ELOG_ASYNC_POLL_GET_LOG_BUF_SIZE #define ELOG_ASYNC_POLL_GET_LOG_BUF_SIZE (ELOG_LINE_BUF_SIZE - 4) #endif +#endif #endif /* ELOG_ASYNC_OUTPUT_USING_PTHREAD */ /* asynchronous output log notice */ static sem_t output_notice; /* asynchronous output pthread thread */ static pthread_t async_output_thread; -#endif /* ELOG_ASYNC_OUTPUT_USING_PTHREAD */ +#endif /* ELOG_ASYNC_OUTPUT_ENABLE */ /* the highest output level for async mode, other level will sync output */ #ifdef ELOG_ASYNC_OUTPUT_LVL