{"id":17195537,"url":"https://github.com/karbonitekream/unklogger","last_synced_at":"2025-04-13T19:51:41.355Z","repository":{"id":47594594,"uuid":"84585604","full_name":"KarboniteKream/unklogger","owner":"KarboniteKream","description":"A simple and colorful logger for Node","archived":false,"fork":false,"pushed_at":"2024-12-30T01:21:00.000Z","size":143,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T07:18:04.628Z","etag":null,"topics":["extensions","hooks","javascript","logging","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/KarboniteKream.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":"2017-03-10T17:42:55.000Z","updated_at":"2024-12-30T01:21:04.000Z","dependencies_parsed_at":"2024-12-30T02:33:27.012Z","dependency_job_id":null,"html_url":"https://github.com/KarboniteKream/unklogger","commit_stats":{"total_commits":64,"total_committers":2,"mean_commits":32.0,"dds":0.046875,"last_synced_commit":"67b440f68610115990850ab78572c95b60225d22"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarboniteKream%2Funklogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarboniteKream%2Funklogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarboniteKream%2Funklogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarboniteKream%2Funklogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KarboniteKream","download_url":"https://codeload.github.com/KarboniteKream/unklogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248773815,"owners_count":21159519,"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":["extensions","hooks","javascript","logging","node"],"created_at":"2024-10-15T01:50:44.561Z","updated_at":"2025-04-13T19:51:41.328Z","avatar_url":"https://github.com/KarboniteKream.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unklogger\n![CI](https://github.com/KarboniteKream/unklogger/workflows/CI/badge.svg)\n\nA simple and colorful logger for Node.js.\n\n## Installation\n```bash\nnpm install [--save] unklogger\n```\n\n## Usage\n```javascript\nimport unklogger from \"unklogger\";\n\nunklogger.log(\"What's up?\");\n// 2017-03-10 18:55:05 | What's up?\n\nunklogger.success(\"Looking good!\");\n// 2017-03-10 18:55:15 | Looking good!\n\nunklogger.error(\"Server #1\", \"OH NO!\");\n// 2017-03-10 19:00:00 | [Server #1] OH NO!\n\nunklogger.warn(\"Response\", \"OK\", { foo: \"0\", bar: \"1\" }, [0, 1, 2]);\n// 2017-03-10 19:11:07 | [Response] OK { foo: \"0\", bar: \"1\" } [0, 1, 2]\n\nunklogger.info([\"Multiple\", \"Tags\"], \"I support multiple tags.\");\n// 2017-03-10 19:11:07 | [Multiple] [Tags] I support multiple tags.\n```\n\n### Configuration\n```javascript\nunklogger.$config = {\n    quiet: false,     // Suppress output.\n    colors: true,     // Enable colors.\n    console: Console, // Override console streams.\n};\n```\n\n### Context\nAll output functions will return the `context` object as the first argument.\n\nIt contains the following properties:\n* `$timestamp`: The current timestamp, same as output.\n* `$tags`: All passed tags as an array.\n* `$message`: All other arguments combined, as a string.\n* `$output`: Text that was/will be logged to the console.\n* `$arguments`: All arguments, exactly as passed to `unklogger`.\n\n### Hooks\nYou can use the `beforeWrite` and `afterWrite` events to add hooks to perform any action. Multiple hooks can be bound to an event. Each is passed the current context.\n\n```javascript\nunklogger.addHook(\"beforeWrite\", (context) =\u003e {\n    context.$output += \" FOO\";\n});\n\nunklogger.addHook(\"beforeWrite\", (context) =\u003e {\n    context.$output += \" BAR\";\n});\n\nunklogger.addHook(\"afterWrite\", (context) =\u003e {\n    axios.post(\"https://www.kream.io/logs\", { output: context.$output });\n});\n\n// Outputs \"ONE FOO BAR\" and sends a POST request with the same output.\nunklogger.info(\"ONE\");\n```\n\n### Extensions\nExtensions are functions returned by `unklogger`, which you can chain after the first call.\n\n```javascript\nunklogger.addExtension(\"send\", (context, url) =\u003e {\n    axios.post(url, { output: context.$output });\n});\n\nunklogger.info(\"GO!\").send(\"https://www.kream.io/logs\");\n```\n\n## Tests\n```bash\nnpm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarbonitekream%2Funklogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarbonitekream%2Funklogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarbonitekream%2Funklogger/lists"}