|
OmniStacksStaticModules 2.0.0
|
import bq.log;import std;Go to the source code of this file.
Classes | |
| struct | interface_log::ApiName |
| 接口名强类型。 语义:调用方必须显式构造 ApiName,避免把任意字符串误当接口名。 More... | |
| struct | interface_log::LogText |
| 接口输入/输出文本强类型。 语义:与 ApiName 一样显式构造,参数顺序在编译期被类型约束。 More... | |
Namespaces | |
| namespace | interface_log |
Enumerations | |
| enum class | interface_log::ApiStatus { interface_log::ok , interface_log::failed } |
| 接口调用结果状态。 More... | |
| enum class | interface_log::LogError { interface_log::invalid_path , interface_log::backend_unavailable } |
| 可恢复的日志初始化错误。 More... | |
Functions | |
| std::expected< std::monostate, LogError > | interface_log::init (const std::filesystem::path &log_path="log/interface.log") |
| 初始化 bqlog TextFileAppender(可重复调用;路径变化会重建后端)。 | |
| std::size_t | interface_log::cleanup_old_logs (const std::filesystem::path &log_path, int months_back=3) |
| 删除超过保留期的接口日志与每日 trace 日志。 | |
| void | interface_log::set_enabled (bool enabled) |
| 启用/禁用接口记录(内存与文件同时生效)。 | |
| bool | interface_log::enabled () |
| 当前是否启用接口记录。 | |
| void | interface_log::record (ApiName api, LogText input, LogText output, ApiStatus status) |
| 记录一次接口调用。 | |
| std::vector< std::string > | interface_log::recent () |
| 取出最近 <= kMaxLines 条记录(最旧在前)。 | |
| std::size_t | interface_log::count () |
| 当前环形缓冲条数(<= kMaxLines)。 | |
| void | interface_log::clear () |
| 清空内存环形缓冲(不动 bqlog 文件)。 | |
| std::filesystem::path | interface_log::log_path () |
| 当前配置的日志路径。 | |
| template<std::invocable< std::string_view > Visitor> | |
| void | interface_log::for_each_recent (Visitor &&visitor) |
| 在锁内逐条访问环形缓冲(函数对象设计)。 | |
| std::string_view | interface_log::status_name (ApiStatus status) noexcept |
| 状态枚举到可读名称(供日志/测试使用)。 | |
| std::string_view | interface_log::log_error_message (LogError error) noexcept |
| LogError 到可读消息(供 CLI / 测试使用)。 | |
| std::string | interface_log::now_string () |
| 当前时间字符串(本地时间,秒级精度)。 | |
Variables | |
| constexpr std::size_t | interface_log::kMaxLines = 1000 |
| 环形缓冲最大记录条数(= 1000)。 | |
| constexpr std::string_view | interface_log::kDeveloperWebsite = "https://suchaharcan.github.io/" |
| 开发者网站水印;每次初始化 bqlog 与 CLI 调用日志都会写出。 | |
| std::mutex | interface_log::g_mutex |
| 保护下列全部可变状态。 | |
| std::deque< std::string > | interface_log::g_lines |
| 最近调用记录;队首最旧。 | |
| std::optional< bq::log > | interface_log::g_logger |
| 可选 bqlog 文件后端。 | |
| std::filesystem::path | interface_log::g_log_path |
| 当前后端日志基准路径。 | |
| bool | interface_log::g_initialized = false |
| bqlog 是否已成功初始化。 | |
| bool | interface_log::g_recording_enabled = true |
| Alfred 配置控制的全局日志开关。 | |