{"_id":"@alesmenzel/churchill","_rev":"4-d648e9e50629cd49b869bb3e40468422","name":"@alesmenzel/churchill","dist-tags":{"latest":"1.0.0-rc.2"},"versions":{"1.0.0-beta.2":{"name":"@alesmenzel/churchill","version":"1.0.0-beta.2","description":"Node logging utility","keywords":["logger","node","utility"],"license":"MIT","contributors":[{"name":"Aleš Menzel","email":"alesmenzel@gmail.com","url":"https://github.com/alesmenzel"}],"main":"index.js","scripts":{"test":"run-s lint test:unit test:acceptance","test:unit":"jest --config jest.config.unit.js","test:acceptance":"jest --runInBand --config jest.config.acceptance.js","lint":"eslint ./src","format":"eslint --fix ./src","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate"},"repository":{"type":"git","url":"git://github.com/alesmenzel/churchill.git"},"engines":{"node":"^12.12.0","npm":"^6.11.3"},"dependencies":{"@elastic/elasticsearch":"^7.4.0","chalk":"^2.4.2","request":"^2.88.0","request-promise-native":"^1.0.7"},"devDependencies":{"@types/jest":"^24.0.18","all-contributors-cli":"^6.9.1","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.3.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","jest":"^24.9.0","npm-run-all":"^4.1.5","prettier":"^1.18.2"},"gitHead":"5bd61bd9d2cb78c9d5c6bbf6ee7ebb22ab30b595","bugs":{"url":"https://github.com/alesmenzel/churchill/issues"},"homepage":"https://github.com/alesmenzel/churchill#readme","_id":"@alesmenzel/churchill@1.0.0-beta.2","_nodeVersion":"12.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-uH5U55std+LKBxHkmH6UAkUIuvHS1Apa0DDBFTnmixDpqy24oYarLC1oYJJ4MmQSZLnNiwQEK/BxC5PoFZEgSQ==","shasum":"a8a13ab187e4cc16394d84fd01c0def3af081fe9","tarball":"https://registry.npmjs.org/@alesmenzel/churchill/-/churchill-1.0.0-beta.2.tgz","fileCount":17,"unpackedSize":38686,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdrKIkCRA9TVsSAnZWagAAqPwP/RqFVninxDsFQ7yaLrGn\ns3GSXHG44VDRRJy/hJWfW/wgWO+L9J6iG29pJrdL/vMbzN3q0E1H9Q1ZzSNz\nX9rnUtQygcXcxo46ZSLER818IhmPxoiJiJxhabBFrsNsZVtm9frFZqpQugGG\ntuZLJ39BlyegSTI0CrTsFA7bBEY4eDaevfH1CTIG10w0C7EPcIe5DuOQrVix\nXGG5tpDbiCGEM4NWWwOnTspkgvGZJ0HAAoivk+bxsT8wkJiNa2wmS8bofwF5\neTw0ra/tjW0NovtNQhi+W8QOO0gWigSkfBsifcLya3J1bkpfppMJPUfCeFsr\nheT0SMIc1uoOCl+xdl5XVBHnyEMpCZNvuIfGZCLGK9zsDMWdxgUprPIZP33Y\nOAAvKu+yyABNCGLbNal8+xNvnbUwWPriGHS4eBBfGs7TOBA40J3aEPDQikiS\n10TQygOUl+c5PN7Bp+pIU5pAFM0//SHMTeP/Xqykr08FClhZdrs0st3ImXEv\nJyjzc4JC6QGdMoQr8TOnB0XxmErckdFJLQD0wXJBC1+ydRT66SZbBt0b92yT\nn+llIOjeHWrK32qNwyiLpN0wFSzaMuWwb2fq7oV32L9f7y0XXqOEwW8qnFD8\nV/zEPWqGfd031mXyuhU/lofROzUSM+DK/M29bA6kQhyK3yskT32ZE6liukHp\nNfMt\r\n=InyX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSfb6EDSWKouYTOoRuvvTVL9gyDHKHkAoy1/SIdRGMZwIgf4pm4EHd+/ZacQoMcX9UD0XokyA5usD8q21HXY9pKsI="}]},"maintainers":[{"name":"alesmenzel","email":"alesmenzel@gmail.com"}],"_npmUser":{"name":"alesmenzel","email":"alesmenzel@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/churchill_1.0.0-beta.2_1571594787428_0.5564160112265453"},"_hasShrinkwrap":false},"1.0.0-rc.0":{"name":"@alesmenzel/churchill","version":"1.0.0-rc.0","description":"Node logging utility","keywords":["logger","node","utility"],"license":"MIT","contributors":[{"name":"Aleš Menzel","email":"alesmenzel@gmail.com","url":"https://github.com/alesmenzel"}],"main":"index.js","scripts":{"test":"run-s lint test:unit test:acceptance","test:unit":"jest --config jest.config.unit.js","test:acceptance":"jest --runInBand --config jest.config.acceptance.js","lint":"eslint ./src","format":"eslint --fix ./src","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate"},"repository":{"type":"git","url":"git://github.com/alesmenzel/churchill.git"},"engines":{"node":"^12.12.0","npm":"^6.11.3"},"dependencies":{"@elastic/elasticsearch":"^7.4.0","chalk":"^2.4.2","request":"^2.88.0","request-promise-native":"^1.0.7"},"devDependencies":{"@types/jest":"^24.0.19","all-contributors-cli":"^6.9.3","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.4.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","graceful-fs":"^4.2.3","jest":"^24.9.0","npm-run-all":"^4.1.5","prettier":"^1.18.2"},"gitHead":"740cf1773846fd8bb4708ed47bee0bd614e5d5db","bugs":{"url":"https://github.com/alesmenzel/churchill/issues"},"homepage":"https://github.com/alesmenzel/churchill#readme","_id":"@alesmenzel/churchill@1.0.0-rc.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-wXm2uMSLSMAw4y88jVs7KaivIbI1gg1MAt9L9MXPPMU2kBvgAR6HIZ7svymSqD1pC1R8gEtavCdIASbYBeKAbA==","shasum":"aab6587862f66494c093689a4e9bbeba23ee6700","tarball":"https://registry.npmjs.org/@alesmenzel/churchill/-/churchill-1.0.0-rc.0.tgz","fileCount":17,"unpackedSize":38936,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduJgrCRA9TVsSAnZWagAALCYP/2tWcoE3L56IckRkPz1C\nK1TOjHcgDvGl4QQE44Slkgf3ur6ewtz+mbLuZG2gwn869hEl+gFpIsnIKkDt\nkKEKB28ngh/Ia5aWYX8V1yHCQc3WVN95c0GBZWx/BPqOjBQAGb0AHtRE4aUu\nigNkO+SfDgp270+7WzjBTCdX3iHVlVyyjB68x4Ni1mrql9KH/4OoY+KFFca3\ngXGMQOU+ig1K01lF6eMBrTJ/c3UEqjcuoTifFC+LpPZMFp3OvI9xqfJI23jH\ncPzAz0/kc16JNTPmyGiWrqHwjqR/GoFh/zpIgyjRYfOTHMST9RAT1VZ1WL/W\n4CExcEoP/HQ132jc8UVJrkiQWCXoiZ+knsz+qOhfrrhbcI8wiqqL6TLf/0Ar\n7eBwz5aTj3zCQvuxCIXFcJAS5Fafqp3elvhs5JyAE71i4n1+uRa4neGfukYA\n548mhmnslkEAQqHJHExZ1zt+6bAuKnwZzUU0AnAgI5jfmXb8ndK+5dgzJZte\npIFpsict7khliIRrwbxwyFgF17+j02IAkxP6bkahaXQOuE2SYQUQ80yqjRTi\nfTJ1kS/wD2TUewp1ldTV+jp8qxBAOkUv6viPIGNFU+A0HbCDeYS0cHx2RKaS\npKCyUJacBwRmbKPFEcWohGgKARR9EezXMJsgyWXdNKyT6Bsv4c8efaxOeP+Y\nmSBM\r\n=bMLG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfXllvMGzDyYTKW1Da/SgTrsJiFLstZ1AbR8tbxVRp4gIhANPd1pY7dGNK2Jf6F8RZvqeb6aX5BJnvoP3mJK7VR3zS"}]},"maintainers":[{"name":"alesmenzel","email":"alesmenzel@gmail.com"}],"_npmUser":{"name":"alesmenzel","email":"alesmenzel@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/churchill_1.0.0-rc.0_1572378667250_0.759016418469435"},"_hasShrinkwrap":false},"1.0.0-rc.1":{"name":"@alesmenzel/churchill","version":"1.0.0-rc.1","description":"Node logging utility","keywords":["logger","node","utility"],"license":"MIT","contributors":[{"name":"Aleš Menzel","email":"alesmenzel@gmail.com","url":"https://github.com/alesmenzel"}],"main":"index.js","scripts":{"test":"run-s lint test:unit test:acceptance","test:unit":"jest --config jest.config.unit.js","test:acceptance":"jest --runInBand --config jest.config.acceptance.js","lint":"eslint ./src","format":"eslint --fix ./src","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate"},"repository":{"type":"git","url":"git://github.com/alesmenzel/churchill.git"},"engines":{"node":"^12.12.0","npm":"^6.11.3"},"dependencies":{"@elastic/elasticsearch":"^7.4.0","chalk":"^2.4.2","request":"^2.88.0","request-promise-native":"^1.0.7"},"devDependencies":{"@types/jest":"^24.0.19","all-contributors-cli":"^6.9.3","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.4.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","graceful-fs":"^4.2.3","jest":"^24.9.0","npm-run-all":"^4.1.5","prettier":"^1.18.2"},"gitHead":"d04880524d4979e8a0d1440614327866fb2f52aa","bugs":{"url":"https://github.com/alesmenzel/churchill/issues"},"homepage":"https://github.com/alesmenzel/churchill#readme","_id":"@alesmenzel/churchill@1.0.0-rc.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-XnYiKrjsVoS17lxZ6B6ARMHRNsJ3nAbs0swvnc38bTEFDXkfHQnTxvEl1VBHnuV7dutG47fx+wIlBwKyPwN4Cg==","shasum":"addbeb960df2e5188827f5e5fe38a8f2d1b7894b","tarball":"https://registry.npmjs.org/@alesmenzel/churchill/-/churchill-1.0.0-rc.1.tgz","fileCount":17,"unpackedSize":38936,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduJiWCRA9TVsSAnZWagAAURAQAJ/+AMEm31JTcW6Tu+EC\n7PqBe1w45+A3jFlIm2+NNAOB9Kz+oPDfkx1THyE6SkFMzxFnnxebeyl2vON9\nD8Gnvq3y5RI3UtI+/qlcU+M8ZCgbfjnJYheL/JBtvWVLGpqeAO2BT7uJYgRp\n+K5gs83v0Qj7y9ZVMPhBo3GEwTcSO4gxJzbNYWyhUNL/QTqHP+ESSgwE1igh\n7SCkLHh/CE36FBsdlYv1d2M3HOxJzRT0JTr0xiLoKvX1w7FlghBd81BezzRK\ntcgfV/MwMNDsQU+z1JpZ4VkCCbmYdimwKRjYWqGIdfDQVlhWNf5r5zcaMmqd\nJ7G2k0WihU+Kpoxa351kid3GVNwWfrEeaRpC61yq4Nrt3ME76blEifRkOt6i\nx5Pi7FuoUrB1uoI/nY6wwNVf18CuMytCJ5N2vd5k5w9gR/Spnt1QVodDrifs\n+giPAoRXMiJdSBGBe/l9sjljs1ZtwH5RpdAVOdUeGcy5s2PcYVceMjCRxLOM\nAxFHEZ+LqLpmCSntN7Y3Fvx4Vq7qblyjxdiuzWn176+JgVARIYLFrXlUYyWY\nJBqnNdP99NB5kdlvdV5pBDxDQQybTgon6kGdT328bWCZrB27VYu4IuckaiY6\nCeYFC8XLkAhddBWtmy1jn8mF76lydrWxs++jsPF3k98/lNg9AGW2NHZg6df8\nnXsD\r\n=rHUI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEyBKwJDPkGdPBXkcoFqWwym5Amxg/31cZJDPT0FfNl7AiArZVR0JsyGz+eGfTpvfu7xAewTQEu7aLqcptf++WVDYw=="}]},"maintainers":[{"name":"alesmenzel","email":"alesmenzel@gmail.com"}],"_npmUser":{"name":"alesmenzel","email":"alesmenzel@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/churchill_1.0.0-rc.1_1572378774269_0.5797727247343534"},"_hasShrinkwrap":false},"1.0.0-rc.2":{"name":"@alesmenzel/churchill","version":"1.0.0-rc.2","description":"Node logging utility","keywords":["logger","node","utility"],"license":"MIT","contributors":[{"name":"Aleš Menzel","email":"alesmenzel@gmail.com","url":"https://github.com/alesmenzel"}],"main":"index.js","scripts":{"test":"run-s lint test:unit test:acceptance","test:unit":"jest --config jest.config.unit.js","test:acceptance":"jest --runInBand --config jest.config.acceptance.js","lint":"eslint ./src","format":"eslint --fix ./src","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate"},"repository":{"type":"git","url":"git://github.com/alesmenzel/churchill.git"},"engines":{"node":"^12.12.0","npm":"^6.11.3"},"dependencies":{"chalk":"^2.4.2"},"devDependencies":{"@elastic/elasticsearch":"^7.4.0","request":"^2.88.0","request-promise-native":"^1.0.7","@types/jest":"^24.0.19","all-contributors-cli":"^6.9.3","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.4.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","graceful-fs":"^4.2.3","jest":"^24.9.0","npm-run-all":"^4.1.5","prettier":"^1.18.2"},"gitHead":"0e780066672970f8e787b5f85eb4ff8ce697f53d","bugs":{"url":"https://github.com/alesmenzel/churchill/issues"},"homepage":"https://github.com/alesmenzel/churchill#readme","_id":"@alesmenzel/churchill@1.0.0-rc.2","_nodeVersion":"12.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-sUk/HxlJN4GAjQOtb0/XpayCJ6Cu2aeJ6WGdvaiNzxqcSvDJ7j7vhePqh3lgphVmC2kgL7SJgFKIo+IcyeXJOA==","shasum":"25d77204f674197ca59d179263dc2ad67f15d53b","tarball":"https://registry.npmjs.org/@alesmenzel/churchill/-/churchill-1.0.0-rc.2.tgz","fileCount":17,"unpackedSize":40069,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduJumCRA9TVsSAnZWagAAJVkP/1F+qyZzB4XBEsjTotCF\nuGGYqkWLx00bbEh/dZ4rX6DRtKc1QPv73c5mMlFYieYoQeYoIrBSUfobqhVS\no7Sk52fXgLrH7XfLxG2Ha46gTw6n97ftJx1LcBAixt0EwQ+KbMCclqTbPJgk\nmX6szx4//S8pxkEGFFS+Vy8CN1ychJDyhlmiEW13b9milH3sjE8cI2U3L9SR\n3m7DsgDOgP62jjjYYeo3wwYnGJeb1QThCuMxWarvqlN9g211aftCN2LH8r7p\n1BCe5+L9QnKXsNOaPxDAO3Si//TaD3pkYv3GzkR3Vjbk8/cNo0iPT4DqZZPe\nlpUvXSiYOYDliY6IAsQgwSOeFAh0Pq4L8aGKFvFmab06CF0BOJZh1uo6c7pC\nIuq1GS7Zn70DPSJivATV3Om8NQAtji5udHuQRpfAoGHjPgT9wUPyRgdolheh\nsyzLBrkW3WgHViYjg3etzwoGEpiUbBtPIPcr/8SnPydcpKerBeqTJz464DSI\nj1q2TsKjWgv09VgmWPY6UWuWsljU+PpEMdpr57MD7YpT9dV7NkxsCfe6+J9h\n8ctyoX2XVYsbhjLf9LuzbJpu4Bzn7+XVM+1RqYZezxU3tdRGM/Xr0wDrvtZs\n8+0v4vFUFSNNAkYyLJlcm/l0rb7iKraMrn9OkneWlYxh439H9Up/HlUPePE2\nkZ2e\r\n=Ro7o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGdG87r7g0Pe9sAbJdChO8fxHFuBqafRu2xhBgeSPZcrAiEAjQYlCLb7dmHzFD2RRex7e2sBWAocL0lo3rvQGjEDJ6M="}]},"maintainers":[{"name":"alesmenzel","email":"alesmenzel@gmail.com"}],"_npmUser":{"name":"alesmenzel","email":"alesmenzel@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/churchill_1.0.0-rc.2_1572379557447_0.8950769795364588"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-20T18:06:27.187Z","1.0.0-beta.2":"2019-10-20T18:06:27.579Z","modified":"2022-04-04T12:37:50.069Z","1.0.0-rc.0":"2019-10-29T19:51:07.382Z","1.0.0-rc.1":"2019-10-29T19:52:54.407Z","1.0.0-rc.2":"2019-10-29T20:05:57.598Z"},"maintainers":[{"name":"alesmenzel","email":"alesmenzel@gmail.com"}],"description":"Node logging utility","homepage":"https://github.com/alesmenzel/churchill#readme","keywords":["logger","node","utility"],"repository":{"type":"git","url":"git://github.com/alesmenzel/churchill.git"},"contributors":[{"name":"Aleš Menzel","email":"alesmenzel@gmail.com","url":"https://github.com/alesmenzel"}],"bugs":{"url":"https://github.com/alesmenzel/churchill/issues"},"license":"MIT","readme":"# Churchill\n\nSimple to use (no overwhelming configuration) NodeJS logging utility. Inspired by [winston](https://github.com/winstonjs/winston) and [debug](https://github.com/visionmedia/debug).\n\n![churchill logger](./assets/sample-colorized.png)\n\n## Installation\n\n```bash\nnpm install @alesmenzel/churchill\n```\n\n## Quick links\n\n- [Churchill](#churchill)\n  - [Installation](#installation)\n  - [Quick links](#quick-links)\n  - [Setup](#setup)\n  - [Transports](#transports)\n    - [Console](#console)\n    - [File](#file)\n    - [Stream](#stream)\n    - [HTTP](#http)\n  - [Elastic](#elastic)\n    - [Socket](#socket)\n  - [Customization](#customization)\n    - [Custom Log Levels](#custom-log-levels)\n    - [Custom Formats](#custom-formats)\n    - [Custom transport](#custom-transport)\n  - [Environmental Variables](#environmental-variables)\n  - [Logging Uncaught Exceptions](#logging-uncaught-exceptions)\n  - [Contributors](#contributors)\n  - [License](#license)\n\n## Setup\n\nSetting up Churchill is easy. Simply call churchill with a list of transports and if you are happy\nwith the default formatting, you can use the logger in your services.\n\n```js\n// logger.js\nconst churchill = require(\"churchill\");\n\nconst { Console, File } = churchill.trasports;\n\nconst createNamespace = churchill({\n  transports: [\n    Console.create(),\n    File.create({ filename: \"error.log\", maxLevel: \"error\" }),\n    File.create({ filename: \"combined.log\" })\n  ]\n});\n```\n\nHere is an example service:\n\n```js\n// worker-a.js\nconst logger = require('./logger')('worker:a')\nlogger.error('Got an error!', new Error('Err!'))\nlogger.warn('Ups?')\nlogger.info('Log me with some data!', { here: { are: 'some metadata' }})\n// the default max log level is info (anything below will not be logged by default)\nlogger.verbose('Hello!')\nlogger.debug( ... )\nlogger.silly( ... )\n```\n\nThe default log levels contiain 6 levels, that are ascending numerical values, where the lower the number the more important the log message is.\n\n```js\nconst LEVELS = {\n  error: 0,\n  warn: 1,\n  info: 2, // Default maximum log level\n  verbose: 3,\n  debug: 4,\n  silly: 5\n};\n```\n\n## Transports\n\nThis is the list of currently supported transports. Check the [examples](./examples) folder to see their usage. (Note that all transports are exported under `churchill.trasports.<Transport>`)\n\n| Name                  | Description                               | Example                                                                 |\n| --------------------- | ----------------------------------------- | ----------------------------------------------------------------------- |\n| [Console](#console)   | Log to console                            | `Console.create({ ... })`                                               |\n| [File](#file)         | Log to a file                             | `File.create({ filename: \"error.log\", level: \"error\", ... })`           |\n| [Stream](#stream)     | Log to any arbitrary stream.              | `Stream.create({ stream: <Stream> })`                                   |\n| [HTTP](#http)         | Log to a HTTP stream.                     | `HTTP.create({ path: \"https://domain.com/path\" })`                      |\n| [Elastic](#elastic)\\* | Log to an elasticsearch index.            | `Elastic.create({ node: \"http://localhost:9200\", index: \"logs\", ... })` |\n| [Socket](#socket)\\*   | (\\*`Not Implemented Yet`) Log to a socket | `Socket.create({ host: \"127.0.0.1\", port: 1337, ... })`                 |\n\n### Console\n\nLog to a terminal. Uses chalk to colorize the output. By setting the `errorLevel` you can change which levels are logged to the standard error (stderr) instead of standard output (stdout). Usually best for local development.\n\n![console](./assets/example-console.png)\n\nOptions:\n\n| Option       | Description                           | Example                                  |\n| ------------ | ------------------------------------- | ---------------------------------------- |\n| `errorLevel` | Max log level to stream to stderr     | `{ errorLevel: \"error\" }`                |\n| `format`     | Custom formatting function.           | `{ format: (info, out, logger) => ... }` |\n| `maxLevel`   | Max level to log into this transport. | `{ maxLevel: \"warn\" }`                   |\n\n### File\n\nLog to a file on the same machine. You must specify a `filename` where to store the logs. Note that the folder must exists before hand.\n\n![file](./assets/example-file.png)\n\nOptions:\n\n| Option     | Description                           | Example                                  |\n| ---------- | ------------------------------------- | ---------------------------------------- |\n| `filename` | Filename to log into                  | `{ filename: \"error.log\" }`              |\n| `format`   | Custom formatting function.           | `{ format: (info, out, logger) => ... }` |\n| `maxLevel` | Max level to log into this transport. | `{ maxLevel: \"warn\" }`                   |\n\n### Stream\n\nLog to any arbitrary stream.\n\nOptions:\n\n| Option     | Description                           | Example                                               |\n| ---------- | ------------------------------------- | ----------------------------------------------------- |\n| `stream`   | Stream to log into                    | `{ stream: fs.createWriteStream(\"temp/stream.log\") }` |\n| `format`   | Custom formatting function.           | `{ format: (info, out, logger) => ... }`              |\n| `maxLevel` | Max level to log into this transport. | `{ maxLevel: \"warn\" }`                                |\n\n### HTTP\n\nLog to a http endpoint. You must install `request` and `request-promise-native`.\n\n```bash\nnpm i request request-promise-native\n```\n\nOptions:\n\n| Option     | Description                                                                                                                                                  | Example                                               |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- |\n| `method`   | HTTP method                                                                                                                                                  | `{ method: \"POST\" }`                                  |\n| `url`      | URL                                                                                                                                                          | `{ url: \"https://log.example.com\" }`                  |\n| `auth`     | Authentication, see [auth request options](https://www.npmjs.com/package/request#requestoptions-callback)                                                    | `{ auth: { username: \"john\", password: \"xxxxx\" } }`   |\n| `headers`  | HTTP headers                                                                                                                                                 | `{ headers: { \"Content-Type\": \"application/json\" } }` |\n| `dataKey`  | How to send the data (e.g. body, qs, json, form, formData). This will use the request appropriate body key, which sets required headers. Defaults to `json`. | `{ dataKey: \"form\" }`                                 |\n| `format`   | Custom formatting function.                                                                                                                                  | `{ format: (info, out, logger) => ... }`              |\n| `maxLevel` | Max level to log into this transport.                                                                                                                        | `{ maxLevel: \"warn\" }`                                |\n\n## Elastic\n\nIn order to log to elastic, first install the elasticsearch library.\n\n```bash\nnpm i @elastic/elasticsearch@7.x\n```\n\n| Option     | Description                                      | Example                                  |\n| ---------- | ------------------------------------------------ | ---------------------------------------- |\n| `client`   | Elasticsearch client (or just pass a `node` URL) | `new Client({ node: \"...\" })`            |\n| `node`     | Elasticsearch node URL                           | `{ node: \"http://localhost:9200\" }`      |\n| `index`    | Index where to store logs.                       | `churchill-log`                          |\n| `format`   | Custom formatting function.                      | `{ format: (info, out, logger) => ... }` |\n| `maxLevel` | Max level to log into this transport.            | `{ maxLevel: \"warn\" }`                   |\n\n### Socket\n\nNot Implemented Yet (you can send a PR 😉 )\n\n## Customization\n\n### Custom Log Levels\n\nYou can also specify custom levels.\n\n```js\nconst customLevels = {\n  critical: 0,\n  warning: 1,\n  log: 2,\n  debug: 3\n};\n\nconst customColors = {\n  critical: \"red\",\n  warning: \"orange\",\n  log: \"blue\",\n  debug: \"gray\"\n};\n\nchurchill({ levels: customLevels, colors: customColors });\n```\n\nAvailable colors are `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `gray`, `redBright`, `greenBright`, `yellowBright`, `blueBright`, `magentaBright`, `cyanBright`, `whiteBright`. For more information check the [chalk](https://www.npmjs.com/package/chalk) package.\n\n### Custom Formats\n\nChurchill supports custom formatting functions. A formatting function accepts `info` (global format) or `info, output, logger` (transport format) objects which is the logged message, globally formatted message and the logger instance. The return value is what will be sent to transport streams.\n\n```js\nconst util = require(\"util\");\n\nconst customGlobalFormat = info => {\n  return { ...info, logger: \"churchill:\" };\n};\n\nconst customFormat = info => {\n  const { logger, namespace, timestamp, level, ms, args } = info;\n\n  return `${logger}${namespace} ${level} ${args.map(arg => util.format(arg)).join(\" \")} +${ms}ms`;\n};\n\nconst createLogger = churchill({\n  format: customGlobalFormat,\n  transports: [Console.create({ format: customFormat })]\n});\n\nconst loggerA = createLogger(\"worker:a\");\nconst loggerB = createLogger(\"worker:b\");\nconst loggerC = createLogger(\"worker:c\");\n\nloggerA.info(\"test\", { metadata: \"some info\" });\n// churchill:worker:a info test { metadata: 'some info' } +1ms\nloggerB.info(\"test\", { metadata: \"some info\" });\n// churchill:worker:b info test { metadata: 'some info' } +0ms\nloggerC.error(\"test\", { metadata: \"some info\" });\n// churchill:worker:c error test { metadata: 'some info' } +0ms\n```\n\n### Custom transport\n\nA transport is a class with a log method. Log method arguments are `info`, `output` and `logger`, where info is the object with logged message, output is formatted message by the global format function and logger is the instance that logged the message. See [implementation](./src/transports) of transports for examples.\n\n```js\nconst { Transport } = require(\"@alesmenzel/churchill\");\n\n// Here is a simple transport that logs to stdout and has option to provide a prefix\n// Note: it does not correcly handle stream backpressure\nclass CustomTransport extends Transport {\n  constructor(opts) {\n    super(opts);\n    const { prefix = \"\" } = opts;\n    this.prefix = prefix;\n  }\n\n  /**\n   * Log a Message\n   * @param {Object} info Message\n   * @param {*} [output] Output of the global formatting function\n   * @param {Logger} logger Logger\n   */\n  async log(info, output, logger) {\n    const out = this.format(info, output, logger);\n    const prefixed = custom ? `${this.prefix}${out}` : out;\n    // Transport is also an EventEmitter, so you can emit events\n    if (custom) {\n      this.emit(\"some-event\", info);\n    }\n    process.stdout.write(prefixed); // naively log to console\n  }\n}\n\n// It is recommented to provide a factory to create your logger\nCustomTransport.create = opts => {\n  return new CustomTransport(opts);\n};\n\nmodule.exports = CustomTransport;\n```\n\n## Environmental Variables\n\nYou can change the funcionality of the logger by setting enviromental variables.\n\n| Variable                | Description                                                                                        |\n| ----------------------- | -------------------------------------------------------------------------------------------------- |\n| `CHURCHILL_DEBUG`       | List of enabled namespaces separated by a comma, can be also used with wildcard (i.e. `worker:a*`) |\n| `CHURCHILL_DEBUG_LEVEL` | Max. level to log (i.e. `debug`)                                                                   |\n\n## Logging Uncaught Exceptions\n\nSimply add listener for the `uncaughtException` and log whatever you need.\n\n```js\nprocess.on(\"uncaughtException\", err => {\n  logger.error(err);\n  // Note: if you use any asynchronous transport, you will need to wait till it is written before exiting the program\n});\n```\n\n## Contributors\n\nHelp us improve and be recognised!\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore -->\n| [<img src=\"https://avatars3.githubusercontent.com/u/8976542?v=4\" width=\"100px;\"/><br /><sub><b>Aleš Menzel</b></sub>](https://github.com/alesmenzel)<br />[💻](https://github.com/alesmenzel/churchill/commits?author=alesmenzel \"Code\") [📖](https://github.com/alesmenzel/churchill/commits?author=alesmenzel \"Documentation\") |\n| :---: |\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n<!-- ALL-CONTRIBUTORS-LIST: START - Do not remove or modify this section -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!\n\n## License\n\nThis package is developed under the [MIT licence]('./LICENCE').\n","readmeFilename":"README.md"}