Skip to content

traits.Interface.DebugConfiguration

github-actions[bot] edited this page Jun 8, 2026 · 1 revision

@zenstone/ts-utils / traits / DebugConfiguration

Interface: DebugConfiguration

Defined in: src/traits/debuggable.ts:35

初始化时传入的调试配置,绑定在类原型上,所有实例共享,运行期不可变。

  • name — 显示在日志头部的模块名称,默认 'Debug'
  • color — name 的颜色值(仅色值,自动包装为 color: <value>),如 '#ff6b6b'
  • style — name 的完整 CSS 样式字符串,优先级高于 color,如 'color: #ff6b6b; font-weight: bold'
  • scopeColor — scope 的颜色值(同 color 规则)
  • scopeStyle — scope 的完整 CSS 样式字符串,优先级高于 scopeColor
  • method — 输出方法:'log'(默认)、'debug',或自定义函数
  • timeFlag — 是否在日志头部追加时间戳;true 使用内置格式,也可传自定义函数
  • format — 自定义头部格式函数,返回传给 console.log 的参数数组

Indexable

[key: string]: unknown

Properties

color?

optional color?: string

Defined in: src/traits/debuggable.ts:37


format?

optional format?: (vars, styles) => string[]

Defined in: src/traits/debuggable.ts:43

Parameters

vars

Record<string, string | null | undefined>

styles

Record<string, string | null | undefined>

Returns

string[]


method?

optional method?: "log" | "debug" | DebugFunction

Defined in: src/traits/debuggable.ts:41


name?

optional name?: string

Defined in: src/traits/debuggable.ts:36


scopeColor?

optional scopeColor?: string

Defined in: src/traits/debuggable.ts:39


scopeStyle?

optional scopeStyle?: string

Defined in: src/traits/debuggable.ts:40


style?

optional style?: string

Defined in: src/traits/debuggable.ts:38


timeFlag?

optional timeFlag?: boolean | TimeFlagFunction

Defined in: src/traits/debuggable.ts:42

Clone this wiki locally