nsuite / attachLogToFunc
Function: attachLogToFunc()
attachLogToFunc<
T>(func):T
Defined in: UtilsDebug.ts:17
为函数添加调试日志包装,自动记录函数调用前后的参数和返回值
Type Parameters
T
T extends Function
Parameters
func
T
需要被包装的目标函数
Returns
T
包装后的函数,调用时会先打印入参日志,执行后打印返回值日志
Example
ts
import { attachLogToFunc } from 'nsuite
attachLogToFunc(console.log)("hello world")