syncTest.cpp 1.5 KB
Newer Older
1
#include <gtest/gtest.h>
2
#include "syncTest.h"
M
Minghao Li 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

/*
typedef enum {
  DEBUG_FATAL = 1,
  DEBUG_ERROR = 1,
  DEBUG_WARN = 2,
  DEBUG_INFO = 2,
  DEBUG_DEBUG = 4,
  DEBUG_TRACE = 8,
  DEBUG_DUMP = 16,
  DEBUG_SCREEN = 64,
  DEBUG_FILE = 128
} ELogLevel;
*/

void logTest(char* s) {
  sFatal("==%s== sync log test: fatal", s);
  sError("==%s== sync log test: error", s);

  sWarn("==%s== sync log test: warn", s);
  sInfo("==%s== sync log test: info", s);

  sDebug("==%s== sync log test: debug", s);

  sTrace("==%s== sync log test: trace", s);
}

void test1() {
  sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
}

void test2() {
  sDebugFlag = DEBUG_DEBUG + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
}

void test3() {
  sDebugFlag = DEBUG_INFO + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
}

void test4() {
  sDebugFlag = DEBUG_ERROR + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
M
Minghao Li 已提交
48
}
M
Minghao Li 已提交
49

M
Minghao Li 已提交
50
int main(int argc, char** argv) {
M
Minghao Li 已提交
51
  taosInitLog("/tmp/syncTest.log", 100);
M
Minghao Li 已提交
52
  tsAsyncLog = 0;
M
Minghao Li 已提交
53
  sDebugFlag = DEBUG_SCREEN + DEBUG_FILE + DEBUG_TRACE + DEBUG_INFO + DEBUG_ERROR;
M
Minghao Li 已提交
54

M
Minghao Li 已提交
55 56 57 58 59
  test1();
  test2();
  test3();
  test4();

M
Minghao Li 已提交
60
  /*
61 62 63 64 65 66 67
  if (argc == 2) {
    bool bTaosDirExist = taosDirExist(argv[1]);
    printf("%s bTaosDirExist:%d \n", argv[1], bTaosDirExist);

    bool bTaosCheckExistFile = taosCheckExistFile(argv[1]);
    printf("%s bTaosCheckExistFile:%d \n", argv[1], bTaosCheckExistFile);
  }
M
Minghao Li 已提交
68
  */
69

M
Minghao Li 已提交
70
  taosCloseLog();
M
Minghao Li 已提交
71 72
  return 0;
}