{"id":26716610,"url":"https://github.com/javascript-studio/studio-log-format","last_synced_at":"2025-03-27T15:38:02.618Z","repository":{"id":57163251,"uuid":"139171997","full_name":"javascript-studio/studio-log-format","owner":"javascript-studio","description":"🎩 Transform streams to format Studio Log streams","archived":false,"fork":false,"pushed_at":"2018-06-29T16:28:09.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T04:36:23.867Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/javascript-studio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2018-06-29T16:26:09.000Z","updated_at":"2018-06-30T10:49:34.000Z","dependencies_parsed_at":"2022-09-12T21:41:49.422Z","dependency_job_id":null,"html_url":"https://github.com/javascript-studio/studio-log-format","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-log-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-log-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-log-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-log-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javascript-studio","download_url":"https://codeload.github.com/javascript-studio/studio-log-format/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245873106,"owners_count":20686532,"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":[],"created_at":"2025-03-27T15:38:01.937Z","updated_at":"2025-03-27T15:38:02.604Z","avatar_url":"https://github.com/javascript-studio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Studio Log Format\n\n🎩 Transform streams to format Studio Log streams\n\n\u003e This module also works in the browser using a [naive `stream` shim][7] for\n\u003e small Browserify bundles.\n\n## Usage\n\n```js\nconst FancyFormat = require('@studio/log-format/fancy');\n\nrequire('@studio/log')\n  .pipe(new FancyFormat())\n  .pipe(process.stdout);\n```\n\n## Install\n\n```bash\n❯ npm i @studio/log-format\n```\n\n## API\n\n### Transform Streams\n\n- `@studio/log-format/basic`: Basic formatting with ISO dates and no colors.\n- `@studio/log-format/fancy`: Colored output with localized dates. This is the\n  default formatter when using the `emojilog` CLI.\n\nSome advanced formatting is applied by naming conventions on top level\nproperties of the `data` object.\n\n- `ts` or prefix `ts_` formats a timestamp.\n- `ms` or prefix `ms_` formats a millisecond value.\n- `bytes` or prefix `bytes_` formats a byte value.\n\nThese options can be passed to the bundled format transforms:\n\n- `ts: false` hide timestamps\n- `topic: false` hide topics\n- `ns: false` hide namespaces\n- `data: false` hide data\n- `stack: style` with these stack styles:\n    - `false`: hide the error entirely\n    - `message` only show the error message\n    - `peek` show the message and the first line of the trace (default)\n    - `full` show the message and the full trace\n\nThe `stack` option is also used to format the `\"cause\"`, if present.\n\n### Writable Streams\n\n- `@studio/log-format/console`: Console logger, making use of the `console.log`\n  default formatting. This format has no options.\n\n## Custom Format Transforms\n\nYou can also write your own format transforms by implementing a [node transform\nstreams][5] in `writableObjectMode`. Here is an example transform\nimplementation, similar to the [ndjson transform][6] for Studio Log:\n\n```js\nconst { Transform } = require('stream');\n\nconst ndjson = new Transform({\n  writableObjectMode: true,\n\n  transform(entry, enc, callback) {\n    const str = JSON.stringify(entry);\n    callback(null, `${str}\\n`);\n  }\n});\n```\n\n## Related modules\n\n- 👻 [Studio Log][1] logs ndjson to an output stream\n- 🏷 [Studio Log Topics][2] defines the topics used by Studio Log\n- 🌈 [Studio Emojilog][3] is a CLI to pretty print the Studio Log ndjson with\n  emoji\n- 📦 [Studio Changes][4] is used to create the changelog for this module.\n\n## License\n\nMIT\n\n\u003cdiv align=\"center\"\u003eMade with ❤️ on 🌍\u003c/div\u003e\n\n[1]: https://github.com/javascript-studio/studio-log\n[2]: https://github.com/javascript-studio/studio-log-topics\n[3]: https://github.com/javascript-studio/studio-emojilog\n[4]: https://github.com/javascript-studio/studio-changes\n[5]: https://nodejs.org/api/stream.html#stream_implementing_a_transform_stream\n[6]: https://github.com/javascript-studio/studio-ndjson\n[7]: https://github.com/javascript-studio/studio-browser-stream\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavascript-studio%2Fstudio-log-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavascript-studio%2Fstudio-log-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavascript-studio%2Fstudio-log-format/lists"}