MCPcopy Create free account
hub / github.com/brillout/react-streaming / createDebugger

Function createDebugger

src/utils/debug.ts:26–39  ·  view source on GitHub ↗
(namespace: Namespace, optionsGlobal?: Options)

Source from the content-addressed store, hash-verified

24 | 'react-streaming:flow'
25
26function createDebugger(namespace: Namespace, optionsGlobal?: Options) {
27 const debugWithOptions = (options: Options) => {
28 return (msg: string, info?: unknown) => {
29 if (!isDebugEnabled(namespace)) return
30 if (info !== undefined) {
31 msg += strInfo(info, { ...optionsGlobal, ...options })
32 }
33 console.log('\x1b[1m%s\x1b[0m', namespace, msg)
34 }
35 }
36 const debug = (msg: string, info?: unknown) => debugWithOptions({})(msg, info)
37 objectAssign(debug, { options: debugWithOptions, isEnabled: isDebugEnabled(namespace) })
38 return debug
39}
40
41function isDebugEnabled(namespace: string): boolean {
42 let DEBUG: undefined | string

Callers 3

common.tsFile · 0.85

Calls 2

objectAssignFunction · 0.85
isDebugEnabledFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…