code: function loggerCreator(logger, options) {
    // debug('loggerCreator', options);
    if (!logger || !logger.error || !logger.warn || !logger.info) {
      throw new Error('logger, logger.error, logger.warn and logger.info are required');
    }
    const pOptions = fp.clone(options || {});
    const getExtraReqHeaders = getHeaderFields(pOptions.headers || []);
    return function bunyanMiddleware(req, res, next) {
      // debug('bunyanMiddleware', req.url);
      // attach the logger to req
      req.logger = logger;
      const startTime = process.hrtime();
      const logs = Object.assign({}, getRequestId(req));
      req.logs = {};
      res.logs = {};
      function logging() {
        // debug('bunyanMiddleware', 'logging', logs.req_id);
        const resLog = Object.assign(
          {},
          logs,
          getStatusCode(res),
          getMethod(req),
          getUrls(req),
          getReqIp(req),
          getResTime(startTime),
          getReqHttpVersion(req),
          { req_headers: Object.assign(
            {}, getExtraReqHeaders(req), getBasicReqHeaders(req)) },
          getReqQuery(req),
          // getReqParams(req),
          getReqPath(req),
          getReqLogs(req),
          getResLogs(res)
        );
  
        const logLevel = defaultLevelFn(resLog.statusCode);
        const logFn = logger[logLevel];
        logFn.call(logger, resLog);
      }
      res.once('finish', logging);
      res.once('close', logging);
      next();
    };
  }
docs: [loggerCreator description]
  @param  {[type]} logger  [description]
  @param  {object} options [description]
  @param  {[string]} options.headers header names to extract
  @return {[type]}         [description]