码迷,mamicode.com
首页 > 其他好文 > 详细

Morgan logger

时间:2016-06-13 13:20:30      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

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);
};

查看这个链接:http://stackoverflow.com/questions/23494956/how-to-use-morgan-logger

Morgan logger

标签:

原文地址:http://www.cnblogs.com/coding4/p/5580134.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!