Files
scaffold/template/frontend/src/utils/logger.ts
T
baozaotumao 008ffc4889 feat: frontend 架构基座(横切层 + 接通 tailwind)
- 横切层:utils/logger(统一日志,禁 console.log)、services/wsClient(通用 WS 客户端)、
  components/ErrorBoundary(错误边界);main.tsx 接 ErrorBoundary + Toaster
- 接通 tailwind:补 tailwind.config.js + postcss.config.js + @tailwind 指令
  (此前 tailwindcss/postcss/autoprefixer 是悬空依赖,无配置)
- vite-env.d.ts:VITE_ 环境变量类型(按 include_backend 渲染)
- App.tsx 改用 tailwind utility class(规则禁自定义 CSS)
- 验证:build/lint/typecheck 三门禁全过

至此三服务架构基座完成:copier 预生成横切层,每个生成项目第一天即结构完整、能跑、过门禁。
2026-06-02 00:46:47 -07:00

15 lines
552 B
TypeScript
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.
// 统一前端日志:dev 输出 consoleprod 可接 Sentry。
// 禁止在组件/hooks 直接用 console.log(见 .claude/rules/frontend-runtime.md)。
export const logger = {
info: (msg: string, ctx?: object): void => {
// eslint-disable-next-line no-console
if (import.meta.env.DEV) console.info(`[INFO] ${msg}`, ctx ?? "");
},
warn: (msg: string, ctx?: object): void => {
console.warn(`[WARN] ${msg}`, ctx ?? "");
},
error: (msg: string, ctx?: object): void => {
console.error(`[ERROR] ${msg}`, ctx ?? "");
},
};