{"_id":"@codebite/logger","_rev":"7-7e40e41d919dd5139ef2263bc3501147","name":"@codebite/logger","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"@codebite/logger","main":"./logger.js","version":"1.0.0","description":"Formatted logging for the esnext server and its plugins","author":{"name":"glromeo@gmail.com"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/glromeo/codebite.git","directory":"packages/esnext-logging"},"dependencies":{"chalk":"^2.4.2","date-fns":"^2.2.1","deepmerge":"^4.0.0"},"devDependencies":{"@types/chalk":"^2.2.0"},"_id":"@codebite/logger@1.0.0","dist":{"shasum":"cb5b4069057898af69c1f272b786df604ff8907a","integrity":"sha512-GRT4xTSkUjT6xMQPUnFJHzCsoVZEVHYHldqfPAyYsiAXMpLOQtcoMVfjeh5TgvhvECMhCRpEM0UD0d+iOl3gqw==","tarball":"https://registry.npmjs.org/@codebite/logger/-/logger-1.0.0.tgz","fileCount":2,"unpackedSize":590,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdl8dGCRA9TVsSAnZWagAAtpUP/iRV3EjKxPjkSlzorDSM\nHG8IQw7Vz4ooLPcw3vmd+N2o4iRNK+v3GNifTBJSMn2uw6iCC1aNyBi2wM60\ngKZ+yvOFFK683Ju9EEMpFfZNvYoANdrlg705iX974qrKWGIBrZauhrL8oBf4\nDGXTL7iJ0p+1IuMhWKkMEJqcNJyxRBgn1DG6U0jINIutZJy6maNuEx9gUNOB\n2oUyFUcn/8oD3UwZOf8bjqPjpcb8jNwV5vlClBzwX/EkQWaA9sJJW37fL8D7\nBrziCgTSgfPMA9sqE6kU1Br08FUAe9TN7FhUzORBy0ADv3+dsZk+Ei3342Ai\nVA/0ESvQmUzCgc+rDDs8Ezh/DNDID68oG52Nzr5/mrZoiS+z4wGeoGP2FQNQ\nyz6VlB4GrdTrg+tldSQTaKwHk8MoxGGC6mB9xkZU1ICEiab8947Brp0SAVVj\n4nUKiaTy5rJ1gY21VRAuWbdaodll9PeFs4lq9mKcZShd94MRoHLrSAkZJHio\nNFsTMUWiMp2JJtwY1Runky8m9HvPVocIIaaeJvThwM/hkilhN3zo0wiGmgCG\nNTmCfrdnt7AhIO2fL9LcSad6L0bg/YqEfx9x/njpcD/OeoKDLuvJaW43V59w\njLmcLBWoyeBvaog9jfReJbXrOn0vQAh5PAmS3fCHJG3zYquxvesBgzUoyJIF\nz6zL\r\n=1WKA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAbqwnZuJb38SQaQmA3Q4N2BRTB50Bb3M3yG7w5HMyjAAiAw8ysKibUs4DJYqRtrln8w7W5XTezIXbP2BYFxNLKLHA=="}]},"maintainers":[{"name":"glromeo","email":"glromeo@gmail.com"}],"_npmUser":{"name":"glromeo","email":"glromeo@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.0.0_1570228037926_0.6444416696844242"},"_hasShrinkwrap":false,"deprecated":"this package has been deprecated"},"3.0.0":{"name":"@codebite/logger","main":"./index.js","version":"3.0.0","description":"A simple log utility for node which uses process stdout write instead of console.","author":{"name":"Gianluca Romeo","email":"glromeo@gmail.com","url":"https://github.com/glromeo/codebite/logger"},"license":"MIT","keywords":["logging","color","node","template"],"bugs":{"url":"https://github.com/glromeo/codebite/logger/issues"},"homepage":"https://github.com/glromeo/codebite/logger#readme","repository":{"type":"git","url":"https://github.com/glromeo/codebite/logger.git"},"dependencies":{"chalk":"^2.4.2"},"devDependencies":{"@types/benchmark":"^1.0.33","@types/jest":"^26.0.0","@types/node":"^14.6.4","benchmark":"^2.1.4","coveralls":"^3.1.0","jest":"^26.4.2"},"scripts":{"test":"jest --coverage && coveralls < coverage/lcov.info"},"licenseText":"MIT License\n\nCopyright (c) 2020 Gianluca Romeo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@codebite/logger@3.0.0","dist":{"shasum":"d1bcbe618290e568958686da2d4ea7f95dda5688","integrity":"sha512-pl718dNOdr2Yrd1aZPYlm1oN4kcFnpcWST5OArCh9NOyIH4PvOjMEiKEUM1fFTi7Xn9E8Ffk6F/jYMQavf9OOQ==","tarball":"https://registry.npmjs.org/@codebite/logger/-/logger-3.0.0.tgz","fileCount":5,"unpackedSize":10768,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkxm4CRA9TVsSAnZWagAA6HIP/jXG18It6iweE+gih8Nr\n/FFsnGmLJhtiurR9P5KxM/w5HdNmUbTFsSVYcW7BJlbhFJlEmyPRuleFKHfz\n0F0qg0EqHJR9qAEFTJWR3CvS2UlD7x5Un0gh8jcFmhwvV3Bu21XP1efRdl62\nQYwNS4PKfLikhAsshbI1y9xu8pMmBfLogIO09LRpgjwMMZjivS9ap1CeyYkQ\nNW0IohnfoAj8CRu7jrkGr42eM8tsTQai7gISw9H6E0x5trpu5+ogMRC+9fw0\nEbxkwBCjACI3NG0trbOE02yxxyS3b3FWE9nIOD1XN+DYmaxrW+ye39wjLAbj\nyha49w5dY3fvCY7t2JqChOLzMHS0bgn3xO8N8KcZVl1HaKvFgPpdY22Yl00o\nOemmiVHThO8irqL49iBVcEdUlvZ50FXn/ValKoISEepUJCVr8Go5J4kqL0lp\ndPbYIqcrUlxDvWVtXT2Ab4o/xbRgNj3q31/IgE9oB8EY3h52DJub5IiimvMl\nHwDphTXV299BSDcfy/wfdYquXxlD1+SNpcYo2p8klukr0LIHcqwVhxlTgfPk\nl7diMtU1p/FOKsOK7v4B/baJ/drqcclFTEPQocmqSywzJTuySygA2H+8ZL8s\nk11OS7xSS2Y5tiAZTHJyqm8JrTm3KX9bRoMg1SAjvoJPPwGksH4Y1pwnB9oC\nqkfo\r\n=z6ZX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+zjrxAx5EQ9F4E8+kBGMMyvTptDbJgHpYaPXL8vu9hAIhAIv/n+40PGwt/1Paurc2gL4R+uCiPex99CAz26iEWN7e"}]},"maintainers":[{"name":"glromeo","email":"glromeo@gmail.com"}],"_npmUser":{"name":"glromeo","email":"glromeo@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_3.0.0_1603475896386_0.48059575082140205"},"_hasShrinkwrap":false,"deprecated":"this package has been deprecated"}},"time":{"created":"2019-10-04T22:27:17.765Z","1.0.0":"2019-10-04T22:27:18.057Z","modified":"2022-04-04T23:59:00.499Z","2.0.0":"2020-08-12T14:20:47.527Z","3.0.0":"2020-10-23T17:58:16.506Z"},"maintainers":[{"email":"npm@npmjs.com","name":"npm"}],"description":"A simple log utility for node which uses process stdout write instead of console.","repository":{"type":"git","url":"https://github.com/glromeo/codebite/logger.git"},"author":{"name":"Gianluca Romeo","email":"glromeo@gmail.com","url":"https://github.com/glromeo/codebite/logger"},"license":"MIT","readme":"![logo](https://github.com/glromeo/codebite/blob/master/logger/logo.svg?raw=true)\n\nA small and fast **node.js** library to create a log that doesn't hurt the eyes!\n##### Main Features\n* The usual levels: `trace`, `debug`, `info`, `warn` & `error`\n* `Syntax coloring` (simple and intuitive)\n* Log call site details: `filename`, `line number` and `column`\n* Can be used as `function calls` or `tagged templates`\n\n\n### Install\n```bash\nnpm i @codebite/logger\n```\n\n### Usage\nOne can log using function calls\n```javascript\nconst log = require(\"@codebite/logger\");\n\nlog(\"Hello world!\")\n```\nor tagged templates\n```javascript\nlog`Hello world!`\n```\nIn both cases instead of a generic log one can use a specific level\n```javascript\nconst {trace, debug, info, warn, error, setLevel} = require(\"@codebite/logger\");\n\nsetLevel(\"trace\"); // otherwise defaults to \"info\"\n\ntrace`Hello world!`\ndebug`Hello world!`\ninfo`Hello world!`\nwarn`Hello world!`\nerror`Hello world!`\n```\nproduces the following output (indicatively):\n\n![colored log output](https://github.com/glromeo/codebite/blob/master/logger/images/example-plain.png?raw=true)\n\n### Details\nThe following example enables the details and uses method calls as an alternative to function calls\n```javascript\n  1 |  const log = require(\"@codebite/logger\");\n  2 |  \n  3 |  log.level = \"trace\";\n  4 |  \n  5 |  log.details = true;\n  6 |  \n  7 |  log.trace(\"Hello world!\");\n  8 |  log.debug(\"Hello world!\");\n  9 |  log.info(\"Hello world!\");\n 10 |  log.warn(\"Hello world!\");\n 11 |  log.error(\"Hello world!\");\n```\nproducing an output similar to this:\n\n![colored log output](https://github.com/glromeo/codebite/blob/master/logger/images/example-with-details.png?raw=true)\n\n### Benchmarks\n```\nconsole.log x 1,494 ops/sec ±0.91% (81 runs sampled)\nsimple x 1,426 ops/sec ±1.01% (88 runs sampled)\ntagged templates x 1,487 ops/sec ±1.22% (86 runs sampled)\ndetailed x 1,362 ops/sec ±0.83% (84 runs sampled)\ndetailed tagged templates x 1,420 ops/sec ±0.85% (86 runs sampled)\n```\nOddly, it seems that tagged templates are faster ...but not by much.\n> The log library is practically as fast as console.log and the impact of enabling the details negligible in comparison to the cost of the write operations\n\n#### References\n\n* Coloured thanks to: [https://github.com/chalk/chalk](https://github.com/chalk/chalk)\n* Logo created using: [https://maketext.io](https://maketext.io)\n* Details extracted using: [https://v8.dev/docs/stack-trace-api](https://v8.dev/docs/stack-trace-api)\n","readmeFilename":"README.md","homepage":"https://github.com/glromeo/codebite/logger#readme","keywords":["logging","color","node","template"],"bugs":{"url":"https://github.com/glromeo/codebite/logger/issues"}}