{"id":21404006,"url":"https://github.com/belguinan/pretty-js-log","last_synced_at":"2025-07-13T22:32:31.857Z","repository":{"id":260173739,"uuid":"879896675","full_name":"belguinan/pretty-js-log","owner":"belguinan","description":"  A light logging package for Node.js and Bun applications. Features file logging and beautiful console output.","archived":false,"fork":false,"pushed_at":"2024-11-06T19:02:29.000Z","size":62,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-14T15:59:06.828Z","etag":null,"topics":["ansi-colors","bun-js","cli-tools","console-log","debug-tools","developer-tools","file-logger","javascript","log-management","logging","monitoring","node-logger","nodejs","npm","terminal-colors"],"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/belguinan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-28T18:31:19.000Z","updated_at":"2024-11-09T14:26:49.000Z","dependencies_parsed_at":"2024-10-30T00:27:43.534Z","dependency_job_id":null,"html_url":"https://github.com/belguinan/pretty-js-log","commit_stats":null,"previous_names":["belguinan/pretty-js-log"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belguinan%2Fpretty-js-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belguinan%2Fpretty-js-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belguinan%2Fpretty-js-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belguinan%2Fpretty-js-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/belguinan","download_url":"https://codeload.github.com/belguinan/pretty-js-log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225925619,"owners_count":17546276,"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":["ansi-colors","bun-js","cli-tools","console-log","debug-tools","developer-tools","file-logger","javascript","log-management","logging","monitoring","node-logger","nodejs","npm","terminal-colors"],"created_at":"2024-11-22T16:11:52.789Z","updated_at":"2025-07-13T22:32:31.840Z","avatar_url":"https://github.com/belguinan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pretty-js-log 📝\n\n[![Node.js CI](https://github.com/belguinan/pretty-js-log/actions/workflows/node.js.yml/badge.svg)](https://github.com/belguinan/pretty-js-log/actions/workflows/node.js.yml)\n[![npm version](https://badge.fury.io/js/pretty-js-log.svg)](https://www.npmjs.com/package/pretty-js-log)\n[![npm downloads](https://img.shields.io/npm/dm/pretty-js-log.svg)](https://www.npmjs.com/package/pretty-js-log)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![Bundle Size](https://img.shields.io/bundlephobia/min/pretty-js-log@1.1.1)](https://bundlephobia.com/package/pretty-js-log@1.1.1)\n[![Bundle Size (gzip)](https://img.shields.io/bundlephobia/minzip/pretty-js-log@1.1.1)](https://bundlephobia.com/package/pretty-js-log@1.1.1)\n\nA lightweight and colorful logging package for Node.js and Bun applications. Makes your console output beautiful and saves logs to files!\n\n## Features\n\n- Colorful console output\n- File logging support\n- Multiple log levels (info, warn, error, debug)\n- Support for both Node.js and Bun\n- JSON object / Array formatting\n- Custom IDs for tracking (like process ID)\n- Timezone-aware timestamps\n\n## Installation 🚀\n\n```bash\n# Using npm\nnpm install pretty-js-log\n```\n\n```bash\n# Using bun\nbun install pretty-js-log\n```\n\n## Quick Start 🎯\n\n```javascript\nconst { logFactory } = require('pretty-js-log');\n\n// Create a basic logger\nconst logger = logFactory({});\n\n// Log some messages\nlogger('Hello World');\nlogger.info('This is an info message');\nlogger.warn('Warning! Something needs attention');\nlogger.error('Oops! Something went wrong');\nlogger.debug('Debug information');\n```\n\n## Output 🎑\n\n![Pretty JS Log Demo](https://i.ibb.co/ZmYhVwT/pretty-js-log.png)\n\n## Advanced Usage 🔧\n\n### Save Logs to File\n\n```javascript\nconst logger = logFactory({\n    path: './logs/app.log',  // Logs will be saved here\n    id: process.pid          // Add process ID to logs\n});\n\nlogger('This will be saved to the file too!');\n```\n\n### Logging Objects\n\n```javascript\nconst data = {\n    user: 'john',\n    age: 25\n};\n\nlogger('User data:', data);  // Objects are automatically formatted\n```\n\n### Disable Console Output\n\nIf you want to write logs only to file without console output, use the `toStdout` option:\n\n```javascript\nconst logger = logFactory({\n    path: './logs/app.log',\n    toStdout: false    // Logs will only be written to file\n});\n\nlogger('This will only appear in the log file');\nlogger.info('Silent logging to file');\n````\n\n### Update Logger ID\nYou can dynamically update the logger ID after creation using the `id` method:\n\n```javascript\nconst logger = logFactory({\n    id: 'initial-id'\n});\n\nlogger('First log with initial ID');\n\nlogger.id('new-id');\nlogger('This log will show the new ID');\n```\n\n## Output Examples 🎨\n\nWhen you run your logs, they'll look something like this in the console:\n\n```\n[2024-03-15 10:30:45] - [id:1234] - Hello World\n[2024-03-15 10:30:46] - [id:1234] - This is an info message\n[2024-03-15 10:30:47] - [id:1234] - Warning! Something needs attention\n```\n\n## Contributing 🤝\n\nFeel free to open issues and submit PRs! This is an open-source project and we welcome contributions.\n\n## License 📄\n\nMIT License - feel free to use this in your projects!\n\n## Todo 📋\n\n- [ ] File logging rotation based on file size or on dates.\n- [ ] Add support for external logging API's endpoints.\n\n## Author 👨‍💻\n\nBelguinan Noureddine\n\nGitHub: https://github.com/belguinan","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelguinan%2Fpretty-js-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelguinan%2Fpretty-js-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelguinan%2Fpretty-js-log/lists"}