1

我希望能够在相关引擎日志中记录我传递给引擎的函数的输出。

IE:

data = /* my list of data to operate on */
def fn(inval):
    import logging
    log = logging.getLogger()
    log.error('This is on the engine')
    // do stuff
    return result

calculated_data = []
for datum in data:
    calc = view.apply(fn, datum)
    calculated_data.append(calc)

我希望能够在执行特定任务的相关引擎日志中看到日志语句。

4

1 回答 1

3

您可以通过以下方式获取当前应用程序(即本例中的引擎)的记录器:

from IPython.config import Application
log = Application.instance().log

然后正常登录,它将进入引擎日志。

于 2013-02-28T21:58:16.593 回答