我不能与摩根登录。它不记录到控制台的信息。文档没有告诉如何使用它。
我想看看什么是变量,这是来自 Expressjs 框架的 response.js
文件的代码:
var logger = require("morgan");
res.render = function(view, options, fn){
options = options || {};
var self = this;
var req = this.req;
var app = req.app;
// support callback function as second arg
if ('function' == typeof options) {
fn = options, options = {};
}
// merge res.locals
options._locals = self.locals;
// default callback to respond
fn = fn || function(err, str){
if (err) return req.next(err);
self.send(str);
};
// Here I want to see what fn is
// But it doesn't show me anything in console
// How to use it?
logger(fn);
// render
app.render(view, options, fn);
};
如何使用摩根?