Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
80d0ea13
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
80d0ea13
编写于
2月 27, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact log
上级
3548b4d7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
28 deletion
+25
-28
include/util/compare.h
include/util/compare.h
+6
-8
include/util/tlog.h
include/util/tlog.h
+1
-2
source/util/src/tlog.c
source/util/src/tlog.c
+18
-18
未找到文件。
include/util/compare.h
浏览文件 @
80d0ea13
...
...
@@ -16,17 +16,18 @@
#ifndef _TD_UTIL_COMPARE_H_
#define _TD_UTIL_COMPARE_H_
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_NOMATCH 1
#define TSDB_PATTERN_NOWILDCARDMATCH 2
#define TSDB_PATTERN_MATCH
0
#define TSDB_PATTERN_NOMATCH
1
#define TSDB_PATTERN_NOWILDCARDMATCH
2
#define TSDB_PATTERN_STRING_DEFAULT_LEN 100
#define TSDB_REGEX_STRING_DEFAULT_LEN 128
#define TSDB_REGEX_STRING_DEFAULT_LEN
128
#define FLT_COMPAR_TOL_FACTOR 4
#define FLT_EQUAL(_x, _y) (fabs((_x) - (_y)) <= (FLT_COMPAR_TOL_FACTOR * FLT_EPSILON))
...
...
@@ -62,7 +63,6 @@ int32_t setChkNotInBytes8(const void *pLeft, const void *pRight);
int32_t
compareChkInString
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareChkNotInString
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Val
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Val
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Val
(
const
void
*
pLeft
,
const
void
*
pRight
);
...
...
@@ -83,7 +83,6 @@ int32_t compareStrRegexComp(const void *pLeft, const void *pRight);
int32_t
compareStrRegexCompMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareStrRegexCompNMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8ValDesc
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16ValDesc
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32ValDesc
(
const
void
*
pLeft
,
const
void
*
pRight
);
...
...
@@ -102,7 +101,6 @@ int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight);
__compar_fn_t
getComparFunc
(
int32_t
type
,
int32_t
optr
);
#ifdef __cplusplus
}
#endif
...
...
include/util/tlog.h
浏览文件 @
80d0ea13
...
...
@@ -22,7 +22,6 @@
extern
"C"
{
#endif
extern
bool
tsLogInited
;
extern
bool
tsAsyncLog
;
extern
int32_t
tsNumOfLogLines
;
extern
int32_t
tsLogKeepDays
;
...
...
@@ -55,7 +54,7 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles);
void
taosCloseLog
();
void
taosResetLog
();
void
taosSetAllDebugFlag
(
int32_t
flag
);
void
taosDumpData
(
u
nsigned
char
*
msg
,
int32_t
len
);
void
taosDumpData
(
u
int8_t
*
msg
,
int32_t
len
);
void
taosPrintLog
(
const
char
*
flags
,
int32_t
dflag
,
const
char
*
format
,
...)
#ifdef __GNUC__
...
...
source/util/src/tlog.c
浏览文件 @
80d0ea13
...
...
@@ -19,12 +19,12 @@
#include "tutil.h"
#include "ulog.h"
#define
MAX_LOG
LINE_SIZE (1000)
#define
MAX_LOGLINE_BUFFER_SIZE (MAX_LOG
LINE_SIZE + 10)
#define
MAX_LOGLINE_CONTENT_SIZE (MAX_LOG
LINE_SIZE - 100)
#define
MAX_LOG
LINE_DUMP_SIZE (65 * 1024)
#define
MAX_LOGLINE_DUMP_BUFFER_SIZE (MAX_LOG
LINE_DUMP_SIZE + 10)
#define
MAX_LOGLINE_DUMP_CONTENT_SIZE (MAX_LOG
LINE_DUMP_SIZE - 100)
#define
LOG_MAX_
LINE_SIZE (1000)
#define
LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_
LINE_SIZE + 10)
#define
LOG_MAX_LINE_CONTENT_SIZE (LOG_MAX_
LINE_SIZE - 100)
#define
LOG_MAX_
LINE_DUMP_SIZE (65 * 1024)
#define
LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_
LINE_DUMP_SIZE + 10)
#define
LOG_MAX_LINE_DUMP_CONTENT_SIZE (LOG_MAX_
LINE_DUMP_SIZE - 100)
#define LOG_FILE_NAME_LEN 300
#define TSDB_DEFAULT_LOG_BUF_SIZE (20 * 1024 * 1024) // 20MB
...
...
@@ -383,7 +383,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
if
(
!
osLogSpaceAvailable
())
return
;
va_list
argpointer
;
char
buffer
[
MAX_LOG
LINE_BUFFER_SIZE
]
=
{
0
};
char
buffer
[
LOG_MAX_
LINE_BUFFER_SIZE
]
=
{
0
};
int32_t
len
;
struct
tm
Tm
,
*
ptm
;
struct
timeval
timeSecs
;
...
...
@@ -398,20 +398,20 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
len
+=
sprintf
(
buffer
+
len
,
"%s"
,
flags
);
va_start
(
argpointer
,
format
);
int32_t
writeLen
=
vsnprintf
(
buffer
+
len
,
MAX_LOG
LINE_CONTENT_SIZE
,
format
,
argpointer
);
int32_t
writeLen
=
vsnprintf
(
buffer
+
len
,
LOG_MAX_
LINE_CONTENT_SIZE
,
format
,
argpointer
);
if
(
writeLen
<=
0
)
{
char
tmp
[
MAX_LOG
LINE_DUMP_BUFFER_SIZE
]
=
{
0
};
writeLen
=
vsnprintf
(
tmp
,
MAX_LOG
LINE_DUMP_CONTENT_SIZE
,
format
,
argpointer
);
strncpy
(
buffer
+
len
,
tmp
,
MAX_LOG
LINE_CONTENT_SIZE
);
len
+=
MAX_LOG
LINE_CONTENT_SIZE
;
}
else
if
(
writeLen
>=
MAX_LOG
LINE_CONTENT_SIZE
)
{
len
+=
MAX_LOG
LINE_CONTENT_SIZE
;
char
tmp
[
LOG_MAX_
LINE_DUMP_BUFFER_SIZE
]
=
{
0
};
writeLen
=
vsnprintf
(
tmp
,
LOG_MAX_
LINE_DUMP_CONTENT_SIZE
,
format
,
argpointer
);
strncpy
(
buffer
+
len
,
tmp
,
LOG_MAX_
LINE_CONTENT_SIZE
);
len
+=
LOG_MAX_
LINE_CONTENT_SIZE
;
}
else
if
(
writeLen
>=
LOG_MAX_
LINE_CONTENT_SIZE
)
{
len
+=
LOG_MAX_
LINE_CONTENT_SIZE
;
}
else
{
len
+=
writeLen
;
}
va_end
(
argpointer
);
if
(
len
>
MAX_LOGLINE_SIZE
)
len
=
MAX_LOG
LINE_SIZE
;
if
(
len
>
LOG_MAX_LINE_SIZE
)
len
=
LOG_MAX_
LINE_SIZE
;
buffer
[
len
++
]
=
'\n'
;
buffer
[
len
]
=
0
;
...
...
@@ -460,7 +460,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
if
(
!
osLogSpaceAvailable
())
return
;
va_list
argpointer
;
char
buffer
[
MAX_LOG
LINE_DUMP_BUFFER_SIZE
];
char
buffer
[
LOG_MAX_
LINE_DUMP_BUFFER_SIZE
];
int32_t
len
;
struct
tm
Tm
,
*
ptm
;
struct
timeval
timeSecs
;
...
...
@@ -475,10 +475,10 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
len
+=
sprintf
(
buffer
+
len
,
"%s"
,
flags
);
va_start
(
argpointer
,
format
);
len
+=
vsnprintf
(
buffer
+
len
,
MAX_LOG
LINE_DUMP_CONTENT_SIZE
,
format
,
argpointer
);
len
+=
vsnprintf
(
buffer
+
len
,
LOG_MAX_
LINE_DUMP_CONTENT_SIZE
,
format
,
argpointer
);
va_end
(
argpointer
);
if
(
len
>
MAX_LOGLINE_DUMP_SIZE
)
len
=
MAX_LOG
LINE_DUMP_SIZE
;
if
(
len
>
LOG_MAX_LINE_DUMP_SIZE
)
len
=
LOG_MAX_
LINE_DUMP_SIZE
;
buffer
[
len
++
]
=
'\n'
;
buffer
[
len
]
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录