使用:var logger = require('morgan');
// 定义日志和输出级别
app.use(logger('dev'));
dev
Concise output colored by response status for development use. The:statustoken will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
:method :url :status :response-time ms - :res[content-length]
Shorter than default, also including response time.
:remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms
The minimal output.
:method :url :status :res[content-length] - :response-time ms
网友评论