以下代码创建一个包含详细信息的日志条目:UserEventType:[object Object],Internal id:11。
define(['N/log'], function (log)
{
function afterSubmit(context)
{
log.debug({
title: 'afterSubmit',
details: 'UserEventType: ' + context.UserEventType + ', Internal id: ' + context.newRecord.id
});
}
});
如何从context.UserEventType中获取有意义的字符串?
context.UserEventType是一个对象。
因此,要获得完整的日志详细信息,您可以使用
log.debug({
title: 'afterSubmit',
details: 'UserEventType: ' + JSON.stringify(context.UserEventType) + ', Internal id: ' + context.newRecord.id
});
要么
log.debug({
title: 'afterSubmit',
details: {
'UserEventType': context.UserEventType,
'Internal id': context.newRecord.id
}
});