feat(diag): 可保留调试日志+版本可追溯机制(阶段0.5止血增强)
解决 EQD-6838 排查时硬编码版本号 v20260729a 散落3处、无法按需开关、
看不到实际加载缓存戳的问题。
层1 运行时开关(核心):
- HtmlUtil.cs 新增 GitCommit(读 AssemblyInformationalVersion,零新依赖)
- _MainLayout.cshtml 注入 window.ylotc.__diag(jsVersion+git+built)
- main.js 顶部新增 otcDebug 工具(banner+log),debug 默认 false 生产零输出
- swapTradeEdit.js / fastVue.base.js 硬编码标记改为 otcDebug.banner
- 开启方式:URL ?otcdebug=1(会话)或 localStorage.setItem('otcdebug','1')(持久)
层2 构建守卫:
- pre-commit 新增第三块 bundle 版本一致性检查(rebuild-bundles.py --verify)
- 修复 Windows python3 Store stub 不可用问题(优先用 python)
- 注:bundle 头部不注入 git sha(会随 commit 变化导致 verify 永久失败),
版本可追溯完全由运行时 __diag(后端注入)覆盖
层3 单测预防:
- 新增 diag.test.js(213测试之一),用 console spy 守卫开关行为
- 断言不再含硬编码 v20260729a + 防止第二套调试开关回归
验证:11 suites/213 tests 全绿,--verify 通过,C# 编译0错误
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
//otcformat禁止千分位分组
|
||||
window.otcformat.options.disableGrouping = true;
|
||||
// 版本标记(排查用):F12 Console 看到 v20260729a 说明加载的是最新版本
|
||||
console.log('[swapTradeEdit.js] v20260729a loaded');
|
||||
// 模块加载横幅(排查用):仅在 ?otcdebug=1 或 localStorage.otcdebug=1 开启时打印,含 bundle 版本+git sha。
|
||||
// otcDebug 由 main.js 提供(在 bundle.js 内),本文件是独立 <script> 且晚于 bundle.js 加载,故 otcDebug 必已就绪。
|
||||
otcDebug.banner('swapTradeEdit.js', '1.4.2');
|
||||
|
||||
const consClients = ylotc.clients;
|
||||
const consTraders = ylotc.traders;
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
//依赖类库:lodash.js + jquery + jquery.validate + bootstrap.emodal.js
|
||||
|
||||
// 统一调试日志工具:仅在 otcdebug 开启时输出,默认静默(生产零噪音)。
|
||||
// 开启方式:URL 加 ?otcdebug=1,或控制台 localStorage.setItem('otcdebug','1')。
|
||||
// 业务脚本逐步改用 otcDebug.banner / otcDebug.log 替代裸 console.log,
|
||||
// 既能在排查时一键全开,又能避免版本标记散落硬编码(见 swapTradeEdit.js / fastVue.base.js 用法)。
|
||||
var __otcDiag = (window.ylotc && window.ylotc.__diag) || { debug: false };
|
||||
window.otcDebug = {
|
||||
// 模块加载横幅:F12 一眼看到模块名+bundle版本+git sha,用于排查"是不是加载了旧代码/旧缓存"
|
||||
banner: function (name, ver) {
|
||||
if (!__otcDiag.debug || !window.console) return;
|
||||
var git = (__otcDiag.git || '').slice(0, 7);
|
||||
console.log('%c[' + name + '] v' + ver + ' (bundle=' + __otcDiag.jsVersion + ', git=' + git + ', built=' + __otcDiag.built + ')',
|
||||
'color:#06c;font-weight:bold');
|
||||
},
|
||||
// 普通调试日志:透传参数,仅 debug 开启时输出
|
||||
log: function () {
|
||||
if (!__otcDiag.debug || !window.console) return;
|
||||
console.log.apply(console, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
var main = window.main || { version: "1.0" };
|
||||
|
||||
main.extend = $.extend;
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
|
||||
(function (window, $) {
|
||||
// 版本标记(排查用):F12 Console 看到 v20260729a 说明 bundle.js 是最新版本
|
||||
if (window.console) console.log('[fastVue.base.js] v20260729a loaded');
|
||||
// 模块加载横幅(排查用):仅在 ?otcdebug=1 或 localStorage.otcdebug=1 开启时打印,含 bundle 版本+git sha。
|
||||
// 注意:本文件在 bundle.js 中早于 main.js(otcDebug 定义处)加载,故直接读 window.ylotc.__diag,不依赖 otcDebug。
|
||||
var __diag = window.ylotc && window.ylotc.__diag;
|
||||
if (__diag && __diag.debug && window.console) {
|
||||
var git = (__diag.git || '').slice(0, 7);
|
||||
console.log('%c[fastVue.base.js] v1.4.2 (bundle=' + __diag.jsVersion + ', git=' + git + ', built=' + __diag.built + ')',
|
||||
'color:#06c;font-weight:bold');
|
||||
}
|
||||
|
||||
function FastVue() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user