{"id":20380529,"url":"https://github.com/tobua/logua","last_synced_at":"2025-08-09T06:20:20.558Z","repository":{"id":57290651,"uuid":"290210031","full_name":"tobua/logua","owner":"tobua","description":"Logging utility for node and the browser.","archived":false,"fork":false,"pushed_at":"2023-12-08T17:01:05.000Z","size":229,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T08:16:07.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/logua","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/tobua.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-08-25T12:32:31.000Z","updated_at":"2024-05-01T15:49:16.000Z","dependencies_parsed_at":"2025-01-15T06:49:01.123Z","dependency_job_id":"f13b53a6-36df-4650-99e4-665b6e8b3c4b","html_url":"https://github.com/tobua/logua","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.02941176470588236,"last_synced_commit":"51a49ebaac8ba7e4fd78c48914c48aa8e6387015"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flogua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flogua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flogua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flogua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobua","download_url":"https://codeload.github.com/tobua/logua/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241929754,"owners_count":20044019,"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-11-15T02:07:42.110Z","updated_at":"2025-03-04T22:23:04.490Z","avatar_url":"https://github.com/tobua.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/tobua/logua/raw/main/logo.png\" alt=\"logua\" width=\"300\"\u003e\n\u003c/p\u003e\n\n# logua\n\nLogging utility for node and the browser. Displays colored package namespace in front and exits on error. Unless message ends in \".!?\\n\" a dot will be added to the end.\n\n```js\nimport { create } from 'logua'\n\n// First create the log with the package context.\nconst log = create('my-pkg', 'blue')\n\nlog(`Found ${files} files`)\n\n// =\u003e my-pkg Found 5 files.\n\nlog('Please add a description field', 'warning')\n\n// =\u003e my-pkg Please add a description field.\n\nlog('package.json file is missing', 'error')\n\n// =\u003e my-pkg package.json file is missing.\n// =\u003e exits the process!\n```\n\nThe following colors are available: black, red, green, yellow, blue, magenta, cyan, white, gray, grey, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, darkOrange, orange\n\n## Separate file\n\n```js\n// log.js\n\nimport { create } from 'logua'\n\nexport const log = create('some-pkg', 'red')\n```\n\nThen import the contextualized log:\n\n```js\nimport { log } from './log.js'\n\nlog('Hello World')\n\n// =\u003e some-pkg Hello World.\n```\n\n## Grouping messages\n\nTo avoid spamming the log messages can be grouped. After a timeout a single message will be output instead of various messages.\n\n```js\nconst files = ['hello.js', 'world.js', 'more-files.js']\n\nfiles.forEach((file) =\u003e\n  log(`Copying ${file}`, {\n    // Some identifier for the group.\n    group: 'copy',\n    // Group message, used if there is more than one log for this id during the timeout.\n    groupMessage: (count: number) =\u003e `Copying ${count} files`,\n    groupMessage: 'Files copied successfully',\n    // Optional timeout until messages are collected.\n    timeout: 100,\n  }),\n)\n\n// =\u003e Copying 3 files.\n```\n\n## Further Options\n\nBy default a newline will be added after each message. This can be changed globally or for each single log.\n\n```js\nconst log = create('my-pkg', 'blue', false) // newLine = false\n\nlog('Hello World', { newLine: true }) // Force newLine for this message.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobua%2Flogua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobua%2Flogua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobua%2Flogua/lists"}