CMakeTutorialStep1 2.3.12
Loading...
Searching...
No Matches
ScenarioLog.hxx File Reference

【不可删除】场景日志公共模块 — exe / gtest / lldb 共用。 More...

#include <spdlog/spdlog.h>
#include <string>
#include <string_view>

Go to the source code of this file.

Namespaces

namespace  scenario_log

Macros

#define CXX_LOG_DIR   "log"
#define CXX_LOG_MAX_LINES   300

Functions

void scenario_log::trim_log_file (const std::string &path)
 读入全文后只保留末尾 CXX_LOG_MAX_LINES 行,防止 log 无限增长
bool scenario_log::under_lldb ()
 CXX_LLDB 非空且非 "0",或 macOS 上进程被 tracer 附加
spdlog::logger & scenario_log::exe_logger ()
 懒初始化:LLDB 下写 lldb_debug.log,否则 exe.log
void scenario_log::log_info (std::string_view msg)
 写 INFO 级日志并触发裁剪
void scenario_log::log_error (std::string_view msg)
 写 ERROR 级日志并触发裁剪
void scenario_log::log_sep ()
 输出分隔线(经 log_info)
spdlog::logger & scenario_log::gtest_logger ()
 GTest 专用 logger,文件名固定 gtest.log.
void scenario_log::gtest_info (std::string_view msg)
 GTest 用 INFO 日志并裁剪 gtest.log.
template<typename In, typename Out>
void scenario_log::gtest_case (std::string_view fn, const In &input, const Out &expected, const Out &actual)
 终端 / gtest.log:记录函数名、输入、预期、实际

Detailed Description

【不可删除】场景日志公共模块 — exe / gtest / lldb 共用。

用途:log/ 下 exe.log、lldb_debug.log、gtest.log 的 spdlog 封装与行数裁剪。 修改每文件最大行数:只改下方 CXX_LOG_MAX_LINES(业务源文件勿再重复定义)。 CMake 侧 cmake_configure.log / cmake_build.log 会从本宏同步,保持一致。

Macro Definition Documentation

◆ CXX_LOG_DIR

#define CXX_LOG_DIR   "log"

◆ CXX_LOG_MAX_LINES

#define CXX_LOG_MAX_LINES   300