TDengine/include/util/tnote.h

65 lines
1.7 KiB
C
Raw Normal View History

2019-11-21 09:18:14 +00:00
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2021-10-04 12:42:53 +00:00
#ifndef _TD_UTIL_NOTE_H
#define _TD_UTIL_NOTE_H
2019-11-21 09:18:14 +00:00
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_NOTE_LINE_SIZE 66000
#define NOTE_FILE_NAME_LEN 300
2020-12-07 15:52:07 +00:00
typedef struct {
int32_t fileNum;
int32_t maxLines;
int32_t lines;
int32_t flag;
int32_t fd;
int32_t openInProgress;
char name[NOTE_FILE_NAME_LEN];
pthread_mutex_t mutex;
} SNoteObj;
extern SNoteObj tsHttpNote;
extern SNoteObj tsTscNote;
2020-12-08 02:56:50 +00:00
extern SNoteObj tsInfoNote;
2020-12-07 15:52:07 +00:00
void taosInitNotes();
void taosNotePrint(SNoteObj* pNote, const char* const format, ...);
2020-12-08 02:56:50 +00:00
void taosNotePrintBuffer(SNoteObj *pNote, char *buffer, int32_t len);
2020-12-07 15:52:07 +00:00
#define nPrintHttp(...) \
2019-11-21 09:18:14 +00:00
if (tsHttpEnableRecordSql) { \
2020-12-07 15:52:07 +00:00
taosNotePrint(&tsHttpNote, __VA_ARGS__); \
2019-11-21 09:18:14 +00:00
}
2020-12-07 15:52:07 +00:00
#define nPrintTsc(...) \
if (tsTscEnableRecordSql) { \
taosNotePrint(&tsTscNote, __VA_ARGS__); \
}
2020-12-08 03:10:04 +00:00
#define nInfo(buffer, len) \
if (tscEmbedded == 1) { \
taosNotePrintBuffer(&tsInfoNote, buffer, len); \
}
2019-11-21 09:18:14 +00:00
#ifdef __cplusplus
}
#endif
2021-10-04 12:42:53 +00:00
#endif /*_TD_UTIL_NOTE_H*/