enh: support specify log output by -o option

This commit is contained in:
kailixu 2024-11-29 13:53:30 +08:00
parent 4b2aea8100
commit d256fb1c27
3 changed files with 7 additions and 7 deletions

View File

@ -42,7 +42,7 @@
#endif
#ifndef CUS_PROMPT
#define CUS_PROMPT "taos"
#define CUS_PROMPT "tao"
#endif
#define TSC_VAR_NOT_RELEASE 1
@ -958,10 +958,10 @@ void taos_init_imp(void) {
taosHashSetFreeFp(appInfo.pInstMap, destroyAppInst);
deltaToUtcInitOnce();
const char *logDirName = CUS_PROMPT "dlog";
ENV_ERR_RET(taosInitLogOutput(&logDirName), "failed to init log output");
if (taosCreateLog(logDirName, 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
(void)printf(" WARING: Create %s failed:%s. configDir=%s\n", logDirName, strerror(errno), configDir);
const char *logName = CUS_PROMPT "slog";
ENV_ERR_RET(taosInitLogOutput(&logName), "failed to init log output");
if (taosCreateLog(logName, 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
(void)printf(" WARING: Create %s failed:%s. configDir=%s\n", logName, strerror(errno), configDir);
tscInitRes = -1;
return;
}

View File

@ -1868,7 +1868,7 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile
TAOS_CHECK_GOTO(taosAddSystemCfg(tsCfg), &lino, _exit);
#if 1 // duplicate operation since already loaded in taosCreateLog
#if 0 // duplicate operation since already loaded in taosCreateLog
if ((code = taosLoadCfg(tsCfg, envCmd, cfgDir, envFile, apolloUrl)) != 0) {
(void)printf("failed to load cfg since %s\n", tstrerror(code));
cfgCleanup(tsCfg);

View File

@ -54,7 +54,7 @@
typedef enum {
LOG_OUTPUT_FILE = 0, // default
LOG_OUTPUT_STDOUT = 1, // stdout set by -o option on the command line
LOG_OUTPUT_STDERR = 2, // stderr set by -e option on the command line
LOG_OUTPUT_STDERR = 2, // stderr set by -o option on the command line
LOG_OUTPUT_NULL = 4, // /dev/null set by -o option on the command line
} ELogOutputType;