Rdzleo aeae073e4f chore(git): 把 components/common/ 纳入 git 跟踪
components/common/ 是项目自己写的代码 (火山 RTC SDK 的 wrapper + HTTP 客户端 + JSON
工具 + 设备管理), 历史上被 .gitignore 的 components/ 规则误排除。共 15 个文件 2750
行项目代码长期未被 git 跟踪, 修改易丢失, 不利于多设备开发和回溯。

主要变动:

1. .gitignore
   - 改 components/ → /components/* (顶层 children 而非目录本身)
   - 加 !/components/common/ 例外, 让项目自己代码进入跟踪
   - 加 esp-spot/**/components/ 显式 ignore 子项目里的 components/ 保持原行为

2. components/common/ 首次入 git (~2750 行)
   - inc/volc_rtc.h, src/volc_rtc.c — 火山 RTC SDK 的封装层
   - inc/volc_http.h, src/volc_http.c — HTTP 客户端
   - inc/util/volc_json.h, src/volc_json.c — JSON 工具
   - inc/base/volc_device_manager.h, src/volc_device_manager.c — RTC 设备凭证管理
   - inc/util/volc_log.h — 日志宏
   - inc/util/volc_list.h — 链表工具
   - inc/volc_conv_ai.h — 会话 AI 接口定义
   - inc/volc_platform.h, src/volc_platform.c — 平台抽象
   - inc/base/volc_base.h — 基础类型

未跟踪的兄弟目录 (保持 ignore):
   - components/78__esp-opus-encoder/ (IDF managed component)
   - components/volc_engine_rtc_lite/ (火山 RTC SDK 二进制库)
   - components/zlib/ (第三方库)

后续 fix(rtc) NULL guard 等 components/common/ 的改动将作为独立 commit。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 13:50:52 +08:00

60 lines
2.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright (2025) Beijing Volcano Engine Technology Ltd.
// SPDX-License-Identifier: Apache-2.0
#ifndef __CONV_AI_SRC_UTIL_VOLC_LOG_H__
#define __CONV_AI_SRC_UTIL_VOLC_LOG_H__
#include <stdio.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
VOLC_LOG_LEVEL_ERROR,
VOLC_LOG_LEVEL_WARN,
VOLC_LOG_LEVEL_INFO,
VOLC_LOG_LEVEL_DEBUG,
VOLC_LOG_LEVEL_VERBOSE,
VOLC_LOG_LEVEL_NONE, // 不输出日志
} volc_log_level_e;
#define VOLC_LOG_LEVEL_DEFAULT VOLC_LOG_LEVEL_INFO
// 日志级别颜色定义
#define LOG_COLOR_RESET "\033[0m"
#define LOG_COLOR_RED "\033[31m"
#define LOG_COLOR_GREEN "\033[32m"
#define LOG_COLOR_YELLOW "\033[33m"
#define LOG_COLOR_BLUE "\033[34m"
#define LOG_COLOR_PRUPLE "\033[35m"
// 定义__FILENAME__宏获取文件名不包含路径
#ifndef __FILENAME__
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
#endif
// 通用日志宏
#define LOG(level, tag, color, format, ...) \
do \
{ \
if (level <= VOLC_LOG_LEVEL_DEFAULT) \
{ \
printf(color "[%s|%s:%d]" format LOG_COLOR_RESET "\n", tag, __FILENAME__, __LINE__, ##__VA_ARGS__); \
fflush(stdout); \
} \
} while (0)
// 分级日志实现
#define LOGV(format, ...) LOG(VOLC_LOG_LEVEL_VERBOSE, "VRB", LOG_COLOR_PRUPLE, format, ##__VA_ARGS__)
#define LOGD(format, ...) LOG(VOLC_LOG_LEVEL_DEBUG, "DBG", LOG_COLOR_BLUE, format, ##__VA_ARGS__)
#define LOGI(format, ...) LOG(VOLC_LOG_LEVEL_INFO, "INF", LOG_COLOR_GREEN, format, ##__VA_ARGS__)
#define LOGW(format, ...) LOG(VOLC_LOG_LEVEL_WARN, "WRN", LOG_COLOR_YELLOW, format, ##__VA_ARGS__)
#define LOGE(format, ...) LOG(VOLC_LOG_LEVEL_ERROR, "ERR", LOG_COLOR_RED, format, ##__VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif /* __CONV_AI_SRC_UTIL_VOLC_LOG_H__ */