(namespace: Namespace, optionsGlobal?: Options)
| 24 | | 'react-streaming:flow' |
| 25 | |
| 26 | function 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 | |
| 41 | function isDebugEnabled(namespace: string): boolean { |
| 42 | let DEBUG: undefined | string |
no test coverage detected
searching dependent graphs…