code: function dev() {
    return function logger(ctx, next) {
      // request
      const start = new Date();
      /* eslint no-console: 0 */
      console.log(`  ${chalk.gray('<--')} ${chalk.bold(ctx.method)} ${chalk.gray(ctx.originalUrl)}`);
  
  
      // calculate the length of a streaming response
      // by intercepting the stream with a counter.
      // only necessary if a content-length header is currently not set.
      const length = ctx.response.length;
      const body = ctx.body;
      let counter;
      if ((length === null || length === undefined) && body && body.readable) {
        /* eslint no-param-reassign: 0 */
        ctx.body = body
          .pipe(counter = new Counter())
          .on('error', ctx.onerror);
      }
  
      // log when the response is finished or closed,
      // whichever happens first.
      const res = ctx.res;
      const onfinish = done.bind(null, 'finish');
      const onclose = done.bind(null, 'close');
      /* eslint no-use-before-define: 0 */
      function done(event) {
        res.removeListener('finish', onfinish);
        res.removeListener('close', onclose);
        log(ctx, start, counter ? counter.length : length, null, event);
      }
  
      res.once('finish', onfinish);
      res.once('close', onclose);
      return next();
    };
  }
docs: Development logger.