{"id":13526239,"url":"https://github.com/lrlna/pino-colada","last_synced_at":"2025-04-13T00:46:14.079Z","repository":{"id":17700345,"uuid":"82495780","full_name":"lrlna/pino-colada","owner":"lrlna","description":"cute ndjson formatter for pino 🌲🍹","archived":false,"fork":false,"pushed_at":"2022-05-22T14:32:40.000Z","size":1160,"stargazers_count":247,"open_issues_count":7,"forks_count":46,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T00:46:08.083Z","etag":null,"topics":["emoji","logger","ndjson","node"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lrlna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-19T22:58:58.000Z","updated_at":"2024-12-16T08:02:23.000Z","dependencies_parsed_at":"2022-08-07T09:00:10.941Z","dependency_job_id":null,"html_url":"https://github.com/lrlna/pino-colada","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fpino-colada","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fpino-colada/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fpino-colada/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fpino-colada/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lrlna","download_url":"https://codeload.github.com/lrlna/pino-colada/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650420,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emoji","logger","ndjson","node"],"created_at":"2024-08-01T06:01:26.809Z","updated_at":"2025-04-13T00:46:14.059Z","avatar_url":"https://github.com/lrlna.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# pino-colada 🍹\n[![npm version][1]][2] [![build status][3]][4]\n[![downloads][5]][6] [![js-standard-style][7]][8]\n\nA cute [ndjson](http://ndjson.org) formatter for [pino](https://github.com/pinojs/pino). \n\n\u003cimg src=\"./pino-colada.png\" alt=\"An example of pino-colada terminal output. The output shows timestamps, messages, stack traces, all colourised for ease of reading. The exact output is as follows:\n15:31:42 ✨ http \u003c-- GET xxx /\n15:31:42 ✨ http --\u003e GET 200 / 11B 9ms\n15:31:49 🚨 helloooo server error \nError: helloooo server error\n    at createError (/Users/lrlna/Code/pino-colada/node_modules/merry/error.js:15:15)\n    at /Users/lrlna/Code/pino-colada/example.js:23:10\n    at proxy (/Users/lrlna/Code/pino-colada/node_modules/wayfarer/index.js:42:17)\n    at Function.\u003canonymous\u003e (/Users/lrlna/Code/pino-colada/node_modules/merry/index.js:81:7)\n    at emit (/Users/lrlna/Code/pino-colada/node_modules/wayfarer/index.js:57:23)\n    at match (/Users/lrlna/Code/pino-colada/node_modules/server-router/index.js:94:12)\n    at Server._router (/Users/lrlna/Code/pino-colada/node_modules/merry/index.js:61:14)\n    at Server.emit (node:events:390:28)\n    at parserOnIncoming (node:_http_server:951:12)\n    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)\n15:31:49 ✨ http \u003c-- GET xxx /error\n15:31:49 ✨ http --\u003e GET 500 /error 0B 0ms\n15:32:02 ⚠️  not found\n15:32:02 ✨ http \u003c-- GET xxx /user\n15:32:02 ✨ http --\u003e GET 404 /user 0B 0ms\n15:32:07 ⚠️  not found\n15:32:07 ✨ http \u003c-- GET xxx /content\n15:32:07 ✨ http --\u003e GET 404 /content 0B 1ms\n15:33:50 ✨ http \u003c-- POST xxx /user\n15:33:50 ✨ http --\u003e POST 200 /user 12B 1ms\" /\u003e\n\n# Usage\nPipe a server that uses pino into pino-colada for logging.\n\n```bash\nnode server.js | pino-colada\n```\n\n## pino-colada\nAfter parsing input from `server.js`, pino-colada returns a stream and pipes it\nover to `process.stdout`. It will output a timestamp, a log level in a form of\nan emoji, and a message.\n\n### Usage as [pino prettifier](http://getpino.io/#/docs/pretty?id=api-example)\n\n```javascript\nconst pino = require('pino')\nconst logger = pino({\n  prettyPrint: {},\n  prettifier: require('pino-colada')\n})\n\nlogger.info('hi')\n```\n\n## Log Output Format\n\npino-colada has a few special-case formatting modes that are enabled by passing\ncertain keys into pino when the data is logged. Errors, for instance, should\nprint out the error message and the stack trace. But not all errors will contain\nthe appropriate keys (such as an error return from a promise).\n\nBelow is an example log message to demonstrate how pino-colada processes the\ndata: \n\n```bash\n10:01:31 🚨 MyNamespace MyFunction Encountered an internal server error GET 500 /test 230B 45ms\nError: Mock Error message triggered.\n    at testHandler (/home/user/index.js:175:20)\n    at /home/user/index.js:398:11\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n{\n  \"err\": {\n    \"msg\": \"Mock Error message triggered.\"\n  }\n}\n```\n\nGiven the following pino log,\n```bash\n{\"level\":30,\"time\":1639403408545,\"pid\":37661,\"hostname\":\"Irinas-MacBook-Pro.local\",\"name\":\"http\",\"message\":\"response\",\"method\":\"GET\",\"url\":\"/error\",\"statusCode\":500,\"elapsed\":3,\"contentLength\":0,\"v\":1}\n```\n\n`pino-colada` produces the following output:\n```\n14:46:04 ✨ http --\u003e GET 500 /error 0B 3ms\n```\n\nThe output corresponds to pino's ndjson. Here are is an annotated explanation of how `pino-colada` formats the logs:\n```\n14:46:04 ✨ http --\u003e GET 500 /error 0B 3ms\n         ┬  ─┬─  ─┬─ ─┬─ ─┬─ ───┬── ┬  ─┬─\n         |   |    |   |   |     |   |   |\n────┬─── |   |    |   |   |     |   |   |\n    ╰── \"time\"    |   |   |     |   |   |\n         |   |    |   |   |     |   |   |\n         ╰── \"level\"  |   |     |   |   | \n             |    |   |   |     |   |   |\n             ╰── \"name\"   |     |   |   |\n                  |   |   |     |   |   |\n                  ╰── \"message\" |   |   |\n                      |   |     |   |   |\n                      ╰── \"method\"  |   |\n                          |     |   |   |\n                          ╰── \"statusCode\"\n                                |   |   |\n                                ╰── \"url\"\n                                    |   |\n                                    ╰── \"contentLength\"\n                                        ╰── \"elapsed\"/\"responseTime\"\n```\n\nA few notes on the formatting:\n- We use these emojis to represent the `\"level\"`:\n  * level 10, trace: '🔍'\n  * level 20, debug: '🐛',\n  * level 30, info: '✨',\n  * level 40, warn: '⚠️',\n  * level 50, error: '🚨',\n  * level 60, fatal: '💀'.\n- If the `\"message\"` value is `request` or `response`, we convert it to `\u003c--` and `--\u003e` respectively.\n- If `\"stack\"` property is present, `pino-colada` will print the stack trace following the formatted error log.\n\n# Install\n```bash\nnpm install pino-colada\n```\n\n# Related content\n- [pino](https://github.com/pinojs/pino)\n- [merry](https://github.com/shipharbor/merry)\n- [garnish](https://github.com/mattdesl/garnish)\n- [@studio/log](https://github.com/javascript-studio/studio-log)\n- [pino-http](https://github.com/pinojs/pino-http)\n- [hapi-pino](https://github.com/pinojs/hapi-pino)\n\n## License\n[MIT](https://tldrlegal.com/license/mit-license)\n\n[1]: https://img.shields.io/npm/v/pino-colada.svg?style=flat-square\n[2]: https://npmjs.org/package/pino-colada\n[3]: https://img.shields.io/travis/lrlna/pino-colada/master.svg?style=flat-square\n[4]: https://travis-ci.org/lrlna/pino-colada\n[5]: http://img.shields.io/npm/dm/pino-colada.svg?style=flat-square\n[6]: https://npmjs.org/package/pino-colada\n[7]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\n[8]: https://github.com/feross/standard\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flrlna%2Fpino-colada","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flrlna%2Fpino-colada","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flrlna%2Fpino-colada/lists"}