我有个问题?在 Angularjs 项目中,我可以使用什么日志来写入文件?Angular 或 log4javascript 的 $log。我有 Angularjs 的 $log 的代码配置:
$log.getInstance = function (context) {
return {
log: enhanceLogging($log.log, context),
info: enhanceLogging($log.info, context),
warn: enhanceLogging($log.warn, context),
debug: enhanceLogging($log.debug, context),
error: enhanceLogging($log.error, context)
};
};
function enhanceLogging(loggingFunc, context) {
return function () {
var modifiedArguments = [].slice.call(arguments);
modifiedArguments[0] = [moment().format("dddd h:mm:ss a") + '::[' + context + ']: '] + modifiedArguments[0];
loggingFunc.apply(null, modifiedArguments);
};
}
它正在工作,但它只写入控制台,现在我想要日志输出到文件?