{"_id":"@brightproductions/sails-hook-bunyan-request-logger","_rev":"2-c19768f0001f09d476206c2a96908d65","name":"@brightproductions/sails-hook-bunyan-request-logger","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@brightproductions/sails-hook-bunyan-request-logger","version":"0.0.2","description":"An extension to sails-hook-bunyan which adds a richer request logger.","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/markwbrown/sails-hook-bunyan-request-logger.git"},"keywords":["sails","bunyan","request","logger"],"author":{"name":"Jeff Ashton"},"license":"ISC","bugs":{"url":"https://github.com/markwbrown/sails-hook-bunyan-request-logger/issues"},"homepage":"https://github.com/markwbrown/sails-hook-bunyan-request-logger#readme","dependencies":{"uuid":"^2.0.1"},"devDependencies":{"expect":"^1.6.0"},"sails":{"isHook":true},"directories":{"test":"test"},"gitHead":"a2356290a5a4199fbadf77d0a18580d4d2e7beb3","_id":"@brightproductions/sails-hook-bunyan-request-logger@0.0.2","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-aoJv2UxX6VLm8akx+AzqRM3inuO3LmRRnM8VqTlwdtLvAxviv1C0aAaAk+SeJ5KyWrTs7Gc0wCC1b7kOTn+ccA==","shasum":"82e7e6580f54d682b1671a163026d911df537d8c","tarball":"https://registry.npmjs.org/@brightproductions/sails-hook-bunyan-request-logger/-/sails-hook-bunyan-request-logger-0.0.2.tgz","fileCount":4,"unpackedSize":7317,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfKfDjCRA9TVsSAnZWagAAvlAP+gNK0jcltzwLeVkz5+9g\ncxLDWb0WBl3/ET87ocit1RzOhuzw7N4uJBTT+9FO/V/DIjD5aj9O0b1/uVeD\nhraY5/PAqdU0a/oaSePZIGkLFlQvtui8M6hZJUGRaHj/TB2lw8GFdABlBl2L\n6Dvf2Qs2oqiantd8nLJsYMVETJ/jcRPl5Afjrf40z2xwWvdcvgO2Ptz96Ceh\nG93CpctZhNxQ0mSuGH5wcI4pxDFgFWZ7m8X/LkCXI+Ga+Y9CB1On7bHPB+D2\nA34vfgvgI6BVAeGgpnfIqocANAzqKdqOLj9RjG66qhDxLzYKwTSb7xh2Kas9\n4CROupUhEP7OLpUF5KZOhz0YQtfIEjI9aVNVrCb/lcsAX3vQGCasR1y3VjSI\nfIpm+SI0YzZPXp2vVLxXU027gKu0YsIJ8sSykYoKRJ/LBmPm63f1KzXgqzo7\nxomtCvb8xnQn8XIDWF2Py9Sn/JPPVzVU4lfhbfBAdkx3vHJ4EbxDS3Il4fky\nyhtQAko17sHfa3ftez6lpq3GRPI8NI0F2Owq6TmAqKYjt23mNI627C5yK5pw\nSgJ/jZ2RkLD4Q4mTY3aXmU0zw3YxXLGmCcM3jucr7rYBhdeblASz1GgC2yaj\nkNT0DQTXvp9jfUgf4IpA9FLyDDfKy9tYY+/wtZmNbOHemQfACCqwJUU2n8BC\nWXzc\r\n=S8IY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEDvn5owo+OEmYEJSCLzDnAjqUpfkkC5/i9uyZxWaG4GAiBePYkCUQuXm0nXWygOx2ZUa44DC6nF4Vbk6/7VSnyYVQ=="}]},"maintainers":[{"name":"_mark_","email":"mark@brightproductions.com"}],"_npmUser":{"name":"_mark_","email":"mark@brightproductions.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sails-hook-bunyan-request-logger_0.0.2_1596584163146_0.9784745506159982"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-04T23:36:02.889Z","0.0.2":"2020-08-04T23:36:03.331Z","modified":"2022-04-04T20:40:25.131Z"},"maintainers":[{"email":"brian@brightproductions.com","name":"bpwebdesign"},{"email":"mark@brightproductions.com","name":"_mark_"}],"description":"An extension to sails-hook-bunyan which adds a richer request logger.","homepage":"https://github.com/markwbrown/sails-hook-bunyan-request-logger#readme","keywords":["sails","bunyan","request","logger"],"repository":{"type":"git","url":"git+https://github.com/markwbrown/sails-hook-bunyan-request-logger.git"},"author":{"name":"Jeff Ashton"},"bugs":{"url":"https://github.com/markwbrown/sails-hook-bunyan-request-logger/issues"},"license":"ISC","readme":"# sails-hook-bunyan-request-logger\nAn extension to [sails-hook-bunyan] which adds a richer request logger.\nIt's installed as a [sails hook] and injected through [sails middleware].\n\nThis request logger adds customizable request id generation, so that all messages for a particular\nrequest are uniquely tagged. More information on request ids:\n\n* https://github.com/trentm/node-bunyan#logchild\n* https://devcenter.heroku.com/articles/http-request-id\n\n## Installation\n\nFirst, install the modules.\n\n```\n$ npm install sails-hook-bunyan\n$ npm install sails-hook-bunyan-request-logger\n```\n\nDisable the [sails-hook-bunyan] built-in request logger.\n\n```\n// config/log.js\nmodule.exports.log = {\n\n    /** Handled by sails-hook-bunyan-request-logger */\n    injectRequestLogger: false\n}\n```\n\nThen, in your project's http config file, inject 'attachBunyanRequestLogger' into your middleware.\nIdealy inject it before any of your custom middleware in order to leverage your request's logger.\n\n```js\n// config/http.js\nmodule.exports.http = {\n\n  middleware: {\n\n    order: [\n      ...\n      'attachBunyanRequestLogger',\n      ...\n    ]\n  }\n```\n\n## Configuration\n\nYou are able to configure the name of request id property serialized in every log message, \nas well you're able to provide a custom request id provider.\n\n```js\n// config/bunyanRequestLogger.js\nmodule.exports.bunyanRequestLogger = {\n\n  /**\n   * The property name of the request id\n   */\n  requestIdProperty: 'reqId',\n  \n  /**\n   * Gets or generates a unique id for the request, and attaches it\n   * to the request logger's options. If no id is returned, then the\n   * request logger is unmodified.\n   *\n   * For example, a heroku style (https://devcenter.heroku.com/articles/http-request-id) provider:\n   *\n   * function( req ) {\n   *   var id = req.headers['x-request-id'] || uuid.v4();\n   *   return req.id;\n   * }\n   *\n   * The default request id provider returns a UUID v4 (without dashes).\n   */\n  requestIdProvider: function( req ) { ... }\n};\n```\n\n [sails hook]: http://sailsjs.org/#!/documentation/concepts/extending-sails/Hooks\n [sails-hook-bunyan]: https://github.com/building5/sails-hook-bunyan\n [sails middleware]: https://github.com/balderdashy/sails-docs/blob/master/concepts/Middleware/Middleware.md\n","readmeFilename":"README.md"}