{"id":15481171,"url":"https://github.com/pyronaur/logthing","last_synced_at":"2025-07-10T06:09:02.836Z","repository":{"id":169976355,"uuid":"646083041","full_name":"pyronaur/logthing","owner":"pyronaur","description":"Simple logging with log channels configurable on the fly","archived":false,"fork":false,"pushed_at":"2023-07-03T09:59:57.000Z","size":181,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T07:39:22.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/logthing","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyronaur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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-27T08:21:29.000Z","updated_at":"2023-05-31T13:23:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"a686f418-b070-437e-8ce5-7f3f1369b564","html_url":"https://github.com/pyronaur/logthing","commit_stats":{"total_commits":57,"total_committers":1,"mean_commits":57.0,"dds":0.0,"last_synced_commit":"db5b9c2edb82b6ee0e0034e2981e23fd90d5fbe9"},"previous_names":["pyronaur/logthing"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pyronaur/logthing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronaur%2Flogthing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronaur%2Flogthing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronaur%2Flogthing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronaur%2Flogthing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyronaur","download_url":"https://codeload.github.com/pyronaur/logthing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronaur%2Flogthing/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264538097,"owners_count":23624426,"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":"2024-10-02T05:02:01.853Z","updated_at":"2025-07-10T06:09:02.803Z","avatar_url":"https://github.com/pyronaur.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🪵  Logthing\n\nSimple logging with log channels configurable on the fly\n\n\u003e Organize your logs without losing your sanity.\n\nLogthing is a versatile and customizable logging library for JavaScript and TypeScript. It provides an effortless approach to produce informative and visually distinct logs, with flexible output methods and extensive customization options.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Importing Logthing](#importing-logthing)\n- [Basic Usage](#basic-usage)\n- [Customization](#customization)\n- [Customize Delivery](#customize-delivery)\n\n## Installation\n\nLogthing can be installed directly from npm. Use the following command to add it to your project:\n\n```shell\nnpm install logthing\n```\n\n## Importing Logthing\n\nYou can import `logthing` from the package like this:\n\n```javascript\nimport { logthing } from 'logthing';\n```\n\n## Basic Usage\n\nLet's get started with a simple usage of `logthing`. Here's how you can create a log channel and print some messages:\n\n```javascript\nconst simple = logthing('Simple');\nsimple.log(\"Welcome to logthing!\");\nsimple.log(\"By default, you have access to the following methods:\", Object.keys(simple));\n```\n\nThis will output:\n\n```\nSimple ❯    log: Welcome to logthing!\nSimple ❯    log: By default, you have access to the following methods:\n                 [\n                   'mute',\n                   'unmute',\n                   'mute_all',\n                   'unmute_all',\n                   'debug',\n                   'log',\n                   'warn',\n                   'error'\n                 ]\n```\n\nAnd did you know? You can chain methods in `logthing`:\n\n```javascript\nsimple.log(\"Here's what they look like:\\n\")\n\t.log(\"Informational message\")\n\t.debug(\"Debug message\")\n\t.warn(\"Warning message\")\n\t.error(\"Error message\");\n```\n\nYour console will now show:\n\n```\nSimple ❯    log: Informational message\nSimple ❯  ◌ debug: Debug message\nSimple ❯  ▲ warn: Warning message\nSimple ❯  ✖ error: Error message\n```\n\n## Customization\n\n`logthing` allows you to customize your logs to your heart's content. You can tailor the output of logs, define multiple types of messages (we call them \"channels\"), customize the flag, symbol, and color of the channel, or even define a completely custom template.\n\n```javascript\nconst custom = logthing('Customization', [\n\t{\n\t\tname: \"templates\",\n\t\ttemplate: \"warn\",\n\t}),\n\t// Basic customization\n\t{\n\t\tname: \"about\",\n\t\tsymbol: \"✪\",\n\t\tcolor: 'cyan',\n\t},\n\t// Custom template\n\t{\n\t\tname: \"all_in\",\n\t\tcolor: 'magenta',\n\t\tsymbol: \"[Symbol]\",\n\t\tflag: \"[Flag]\",\n\t\tprefix: \"[Prefix]\",\n\t},\n]);\n```\n\n### Customize Delivery\n\nWant to send your logs somewhere other than the console? `logthing` gives you the power to define your own delivery methods. This is especially useful if you want to send your logs to a file system or a remote server.\n\n```typescript\nimport { Console, logthing } from 'logthing';\nclass FSLog\u003cT extends string\u003e {\n\tconstructor (public readonly name: T) { }\n\tdeliver(...args: unknown[]) {\n\t\tconsole.log(\"*Pretend* writing to FileSystem:\", ...args, \"\\n\");\n\t}\n}\n\nconst custom_console = logthing('Custom Console', [\n\t[\n\t\t// Console is the default delivery method.\n\t\tnew Console(\"Custom Console\", \"info\"),\n\t\tnew FSLog(\"\n\n`Logthing` is a versatile and customizable logging library for JavaScript and TypeScript. It provides an organized and configurable way to handle console.log calls. You can install it via npm using the command `npm install logthing`.\n\nHere is a simple example of how to use `logthing`:\n\n```javascript\nimport { logthing } from 'logthing';\n\nconst simple = logthing('Simple');\nsimple.log(\"Welcome to logthing!\");\nsimple.log(\"By default, you have access to the following methods:\", Object.keys(simple));\n```\n\nBy default, you have access to the following methods: 'mute', 'unmute', 'mute_all', 'unmute_all', 'debug', 'log', 'warn', 'error'. You can also chain these methods:\n\n```javascript\nsimple.log(\"Here's what they look like:\\n\")\n\t.log(\"Informational message\")\n\t.debug(\"Debug message\")\n\t.warn(\"Warning message\")\n\t.error(\"Error message\");\n```\n\n`logthing` offers extensive customization options. You can customize the output of logs, define multiple types of messages (called \"channels\"), customize the flag, symbol, and color of the channel, or even define a completely custom template. Here's an example:\n\n```javascript\nconst custom = logthing('Customization', [\n\t{\n\t\tname: \"templates\",\n\t\ttemplate: \"warn\",\n\t}),\n\t{\n\t\tname: \"about\",\n\t\tsymbol: \"✪\",\n\t\tcolor: 'cyan',\n\t},\n\t{\n\t\tname: \"all_in\",\n\t\tcolor: 'magenta',\n\t\tsymbol: \"[Symbol]\",\n\t\tflag: \"[Flag]\",\n\t\tprefix: \"[Prefix]\",\n\t},\n]);\n```\n\n`logthing` also allows you to define your own delivery methods, which is useful if you want to send your logs somewhere other than the console, such as a file system or a remote server.\n\n```typescript\nimport { Console, logthing } from 'logthing';\n\nclass FSLog\u003cT extends string\u003e {\n\tconstructor (public readonly channel: T) { }\n\tdeliver(...args: unknown[]) {\n\t\tconsole.log(\"*Pretend* writing to FileSystem:\", ...args, \"\\n\");\n\t}\n}\n\nconst custom_console = logthing('Custom Console', [\n\t[\n\t\tnew Console(\"Custom Console\", \"info\"),\n\t\tnew FSLog(\"info\")\n\t],\n\t[\n\t\tnew Console(\"Custom Console\", \"warn\"),\n\t\tnew FSLog(\"warn\")\n\t],\n]);\n\ncustom_console.info(\"This is an info message that's written to the console and to a custom delivery method.\");\ncustom_console.warn(\"This is a warning message that's written to the console and to a custom delivery method.\");\n```\n\n\n## Environment Variables\n\nUse `LOGTHING_MUTE` and `LOGTHING_UNMUTE` to mute channels and logthings by either channel or logthing name.\n\nExamples:\n\nMute logthings named `Simple` and `Customization`:\n\n```shell\nLOGTHING_MUTE=Simple,Customization\n```\n\nUnmute all info channels:\n\n```shell\nLOGTHING_MUTE=info\n```\nMute Simple logthing and info channels:\n\n```shell\nLOGTHING_MUTE=Simple,info\n```\n\nMute everything\n\n```shell\nLOGTHING_MUTE=\n```\n\nBoth `LOGTHING_MUTE` and `LOGTHING_UNMUTE` work the same way, and can even be used together, for example, this will mute everything except info channels:\n\n```shell\nLOGTHING_MUTE=\nLOGTHING_UNMUTE=info\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyronaur%2Flogthing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyronaur%2Flogthing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyronaur%2Flogthing/lists"}