opt log
This commit is contained in:
parent
b8a9e4d364
commit
01819f202e
|
@ -675,7 +675,7 @@ static inline void taosPrintLogImp(ELogLevel level, int32_t dflag, const char *b
|
||||||
use taosPrintLogImpl_useStackBuffer to avoid stack overflow
|
use taosPrintLogImpl_useStackBuffer to avoid stack overflow
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int8_t taosPrintLogImpl_useStackBuffer(const char *flags, int32_t level, int32_t dflag, const char *format,
|
static int8_t taosPrintLogImplUseStackBuffer(const char *flags, int32_t level, int32_t dflag, const char *format,
|
||||||
va_list args) {
|
va_list args) {
|
||||||
char buffer[LOG_MAX_STACK_LINE_BUFFER_SIZE];
|
char buffer[LOG_MAX_STACK_LINE_BUFFER_SIZE];
|
||||||
int32_t len = taosBuildLogHead(buffer, flags);
|
int32_t len = taosBuildLogHead(buffer, flags);
|
||||||
|
@ -696,7 +696,7 @@ int8_t taosPrintLogImpl_useStackBuffer(const char *flags, int32_t level, int32_t
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int8_t taosPrintLogImpl_useHeapBuffer(const char *flags, int32_t level, int32_t dflag, const char *format,
|
static int8_t taosPrintLogImplUseHeapBuffer(const char *flags, int32_t level, int32_t dflag, const char *format,
|
||||||
va_list args) {
|
va_list args) {
|
||||||
char *buffer = taosMemoryCalloc(1, LOG_MAX_LINE_BUFFER_SIZE + 1);
|
char *buffer = taosMemoryCalloc(1, LOG_MAX_LINE_BUFFER_SIZE + 1);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
|
@ -726,9 +726,9 @@ void taosPrintLog(const char *flags, int32_t level, int32_t dflag, const char *f
|
||||||
va_start(argpointer, format);
|
va_start(argpointer, format);
|
||||||
va_copy(argpointer_copy, argpointer);
|
va_copy(argpointer_copy, argpointer);
|
||||||
|
|
||||||
if (taosPrintLogImpl_useStackBuffer(flags, level, dflag, format, argpointer) == 0) {
|
if (taosPrintLogImplUseStackBuffer(flags, level, dflag, format, argpointer) == 0) {
|
||||||
} else {
|
} else {
|
||||||
TAOS_UNUSED(taosPrintLogImpl_useHeapBuffer(flags, level, dflag, format, argpointer_copy));
|
TAOS_UNUSED(taosPrintLogImplUseHeapBuffer(flags, level, dflag, format, argpointer_copy));
|
||||||
}
|
}
|
||||||
va_end(argpointer_copy);
|
va_end(argpointer_copy);
|
||||||
va_end(argpointer);
|
va_end(argpointer);
|
||||||
|
|
Loading…
Reference in New Issue