geopro/src/app/Logging.hpp

19 lines
903 B
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.

#pragma once
#include <QString>
namespace geopro::app {
// 初始化全局日志与崩溃捕获。需在 QApplication 构造、setOrganizationName/setApplicationName
// 之后调用一次(依赖 AppLocalDataLocation 定位日志目录)。
// - 安装 qInstallMessageHandler全 App 的 qDebug/qInfo/qWarning/qCritical/qFatal 写入
// 带时间戳/级别的滚动日志文件(%LOCALAPPDATA%/<Org>/<App>/logs/geopro_YYYYMMDD.log
// - 安装崩溃捕获:未处理 SEH 异常(段错误等)+ std::terminate未捕获 C++ 异常)→
// 记录异常码/地址 + flush 日志,并在 Windows 上用 DbgHelp 写 crash_*.dmp可 VS/WinDbg 事后分析)。
// - 启动时清理 14 天前的旧日志/dump。
void initLogging();
// 当前日志目录绝对路径(供 UI「打开日志目录」等使用可选
QString logDirectory();
} // namespace geopro::app