{"id":20522089,"url":"https://github.com/pannh/beautify-logs","last_synced_at":"2025-03-06T00:28:34.610Z","repository":{"id":164092550,"uuid":"639004641","full_name":"PannH/beautify-logs","owner":"PannH","description":"Elegant logs for your elegant apps with many available formats and Markdown formatting.","archived":false,"fork":false,"pushed_at":"2023-05-11T17:55:04.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-15T06:46:29.908Z","etag":null,"topics":["beautiful","colored","colorful","colors","library","logs","module","npm","package","pnpm","pretty","yarn"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/beautify-logs","language":"TypeScript","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/PannH.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":"2023-05-10T14:54:31.000Z","updated_at":"2023-10-17T16:28:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"b405b858-6716-475b-a433-a4c12037803d","html_url":"https://github.com/PannH/beautify-logs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PannH%2Fbeautify-logs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PannH%2Fbeautify-logs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PannH%2Fbeautify-logs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PannH%2Fbeautify-logs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PannH","download_url":"https://codeload.github.com/PannH/beautify-logs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242127591,"owners_count":20076143,"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":["beautiful","colored","colorful","colors","library","logs","module","npm","package","pnpm","pretty","yarn"],"created_at":"2024-11-15T22:33:59.729Z","updated_at":"2025-03-06T00:28:34.585Z","avatar_url":"https://github.com/PannH.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✨ Beautify Logs\nThis library provides to your app a set of pretty and colorful log formats with different importance levels (debug, info, warn, error, and fatal). It even gives you the opportunity to use markdown in your logs.\n\n## 📥 Installation\n#### npm\n```bash\nnpm install beautify-logs\n```\n#### yarn\n```bash\nyarn add beautify-logs\n```\n#### pnpm\n```bash\npnpm add beautify-logs\n```\n\n## 🖐️ Getting Started\n#### Import the main class\n```js\nconst { Logger } = require('beautify-logs');\n```\n#### Instantiate the imported class with your own options [(check their description further below)](#⚙️-logger-options)\n```js\nconst logger = new Logger({ ... });\n```\n#### Start logging\n```js\nlogger.debug('Lorem Ipsum dolor sit amet.');\n\nlogger.info('Lorem Ipsum dolor sit amet.');\n\nlogger.warn('Lorem Ipsum dolor sit amet.');\n\nlogger.error('Lorem Ipsum dolor sit amet.');\n\nlogger.fatal('Lorem Ipsum dolor sit amet.');\n```\n#### Bonus: how to use the Logger class instance in any of your app file\nTo do so, simply assign the logger property to the `process` in your index file.\n```js\nObject.assign(process, {\n   logger: logger\n});\n\nprocess.logger.debug('The logger is now usable from anywhere!');\n```\n\n## ⚙️ Logger options\nYou can personalize your logger by providing your own options.\n\n#### 1. The format\nYou can choose one of the many available formats [(check further below)](#🦋-log-formats-preview). Default value is: 0\n```js\nconst logger = new Logger({\n   format: 3\n});\n\nlogger.debug('This is the third format!');\n```\n##### Result :\n![Third Format Preview](https://media.discordapp.net/attachments/737366213813862521/1106257165230026793/4oApYrir.png?width=548\u0026height=67)\n\n#### 2. The message splitting\nYou can provide as many messages as you want at once in a single log. This option allows you to wether split those or not. Default value is: false\n```js\nconst logger = new Logger({\n   splitMessages: true\n});\n\nlogger.debug('Hello, World!', 'How is your day going?');\n```\n##### Result :\n![Message Splitting Preview](https://media.discordapp.net/attachments/737366213813862521/1106258869447045202/bbpJ4pbu.png?width=303\u0026height=68)\n---\n```js\nconst logger = new Logger({\n   splitMessages: false\n});\n\nlogger.debug('Hello, World!', 'How is your day going?');\n```\n##### Result :\n![Message Splitting Preview](https://media.discordapp.net/attachments/737366213813862521/1106259062619897937/HKKtRMrM.png?width=425\u0026height=57)\n\n#### 3. The message formatting\nYou can choose to wether format the messages with some Markdown (bold, italic, underline, and URL coloring) or not. Default value is: true\n```js\nconst logger = new Logger({\n   formatMessages: true\n});\n\nlogger.debug('Here is some **bold**, *italic*, __underline__, and https://example.com/');\n```\n##### Result :\n![Message Formatting Preview](https://media.discordapp.net/attachments/737366213813862521/1106261475061936218/mus6989V.png?width=656\u0026height=62)\n---\n```js\nconst logger = new Logger({\n   formatMessages: false\n});\n\nlogger.debug('Here is some **bold**, *italic*, __underline__, and https://example.com/');\n```\n##### Result :\n![Message Splitting Preview](https://media.discordapp.net/attachments/737366213813862521/1106261615801798706/QGYtxZaZ.png?width=750\u0026height=66)\n\n## 🦋 Log Formats Preview\n#### Format No. 0\n![Format No. 0 Preview](https://media.discordapp.net/attachments/737366213813862521/1106264692869058590/CFnfMkva.png?width=334\u0026height=269)\n#### Format No. 1\n![Format No. 1 Preview](https://media.discordapp.net/attachments/737366213813862521/1106264699739312269/UOZEDnwg.png?width=559\u0026height=271)\n#### Format No. 2\n![Format No. 2 Preview](https://media.discordapp.net/attachments/737366213813862521/1106264739773939772/x9WD7iNA.png?width=325\u0026height=267)\n#### Format No. 3\n![Format No. 3 Preview](https://media.discordapp.net/attachments/737366213813862521/1106264841058009098/cK48m0ND.png?width=545\u0026height=270)\n#### Format No. 4\n![Format No. 4 Preview](https://media.discordapp.net/attachments/737366213813862521/1106264879674953819/U7fT2dfB.png?width=332\u0026height=275)\n#### Format No. 5\n![Format No. 5 Preview](https://media.discordapp.net/attachments/737366213813862521/1106264922016464956/yjUINxe0.png?width=562\u0026height=269)\n#### Format No. 6\n![Format No. 6 Preview](https://media.discordapp.net/attachments/737366213813862521/1106265016287637704/AfrGJCTj.png?width=316\u0026height=358)\n#### Format No. 7\n![Format No. 7 Preview](https://media.discordapp.net/attachments/737366213813862521/1106265181555785768/FzffnRl6.png?width=291\u0026height=266)\n\n* Note: The colors may slightly vary according to your terminal colors.\n* More formats will come soon!\n\n## 🔎 Object Inspecting\nIf an object is given as a message instead of a string, the library will display its whole content using `util.inspect(...)` method.\n#### Example\n```js\nconst user = {\n   fullName: 'John Doe',\n   birthDate: new Date(1989, 8, 22),\n   hobbies: [\n      'programming',\n      'sport'\n   ],\n   familyMembers: {\n      parents: {\n         mother: 'Coralie Clark',\n         father: 'William Doe'\n      }\n   }\n};\n\nlogger.info('A user was created:', user);\n```\n##### Result :\n![Object Inspecting Example](https://media.discordapp.net/attachments/737366213813862521/1106274038256509029/heIpHmJV.png?width=738\u0026height=144)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpannh%2Fbeautify-logs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpannh%2Fbeautify-logs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpannh%2Fbeautify-logs/lists"}