例如,你可以创建一个以标准方法把测试结果保存到硬盘的日志函数。
For example, you might create a function that logs test results to disk in a standardized way.
此外,所调用的函数的名称将输出到命令行,通过这种方式,模板即可为各函数添加简单的日志。
In addition, the template adds simple logging to each function by printing out to the command line the name of the function called.
这种情况下返回的函数对象就是一个闭包,其中封装了一些日志代码和最初的函数调用所需要的数据。
In this case the returned function object is a closure which encapsulates some logging code and the data needed to call the original function.
应用推荐