Ghost/core/server/middleware
Katharina Irrgang 0e13ef8767 🎨 logging improvements (#7597)
* 🎨  rotation config
  - every parameter is configureable
  - increase default number of files to 100
* 🎨  ghost.log location
  - example: content/logs/http___my_ghost_blog_com_ghost.log
  - user can change the path to something custom by setting logging.path
* 🛠   add response-time as dependency
* 🎨  readable PrettyStream
  - tidy up
  - generic handling (was important to support more use cases, for example: logging.info({ anyKey: anyValue }))
  - common log format
  - less code 🕵🏻
* 🎨  GhostLogger cleanup
  - remove setLoggers -> this function had too much of redundant code
  - instead: add smart this.log function
  - remove logging.request (---> GhostLogger just forwards the values, it doesn't matter if that is a request or not a request)
  - make .warn .debug .info .error small and smart
* 🎨  app.js: add response time as middleware and remove logging.request
* 🎨  setStdoutStream and setFileStream
  - redesign GhostLogger to add CustomLoggers very easily

----> Example CustomLogger

function CustomLogger(options) {
  // Base iterates over defined transports
  // EXAMPLE: ['stdout', 'elasticsearch']
  Base.call(this, options);
}
util.inherits(...);

// OVERRIDE default stdout stream and your own!!!
CustomLogger.prototype.setStdoutStream = function() {}

// add a new stream
// get's called automatically when transport elasticsearch is defined
CustomLogger.prototype.setElasticsearchStream = function() {}

* 🎨  log into multiple file by default
  - content/logs/domain.error.log --> contains only the errors
  - content/logs/domain.log --> contains everything
  - rotation for both files
* 🔥  remove logging.debug and use npm debug only
*   shortcuts for mode and level
* 🎨  jshint/jscs
* 🎨  stdout as much as possible for an error
* 🎨  fix tests
* 🎨  remove req.ip from log output, remove response-time dependency
* 🎨  create middleware for logging
  - added TODO to move logging middleware to ignition
2016-10-25 12:17:43 +01:00
..
api 🎨 one token endpoint (#7571) 2016-10-17 12:45:50 +02:00
validation Error creation (#7477) 2016-10-06 13:27:35 +01:00
cache-control.js deps: grunt-jscs@2.1.0 2015-10-12 19:21:16 +01:00
check-ssl.js 🎉 🎨 Remove middleware/index.js (#7548) 2016-10-13 17:24:09 +02:00
error-handler.js 🎨 error improvements (#7600) 2016-10-21 13:10:17 +01:00
ghost-locals.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
labs.js 🎨 configurable logging with bunyan (#7431) 2016-10-04 16:33:43 +01:00
log-request.js 🎨 logging improvements (#7597) 2016-10-25 12:17:43 +01:00
maintenance.js Error creation (#7477) 2016-10-06 13:27:35 +01:00
pretty-urls.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
redirect-to-setup.js Ghost OAuth (#7451) 2016-09-30 12:45:59 +01:00
serve-shared-file.js 🎨 change how we get and set config 2016-09-20 15:59:34 +01:00
static-theme.js 🎨 🔦 refactor content paths (images, apps, themes, storage, scheduling) 2016-09-20 15:59:34 +01:00
theme-handler.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
uncapitalise.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00