{"id":17345789,"url":"https://github.com/Marinerer/diy-log","last_synced_at":"2025-02-26T01:33:05.843Z","repository":{"id":57213189,"uuid":"161761497","full_name":"Meqn/diy-log","owner":"Meqn","description":"🌈 Various console log level prefixes with support for color symbols and tags. 📟 自定义控制台各种级别日志输出的前缀，支持颜色符号，标签和时间。","archived":false,"fork":false,"pushed_at":"2023-12-21T11:35:12.000Z","size":159,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-14T19:17:31.219Z","etag":null,"topics":["console","log","log-symbols","logger","logging","terminal"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/diy-log","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/Meqn.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":"2018-12-14T09:24:04.000Z","updated_at":"2023-11-14T12:26:50.000Z","dependencies_parsed_at":"2023-12-21T13:18:13.570Z","dependency_job_id":null,"html_url":"https://github.com/Meqn/diy-log","commit_stats":null,"previous_names":["mengqing723/diy-log"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meqn%2Fdiy-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meqn%2Fdiy-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meqn%2Fdiy-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meqn%2Fdiy-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meqn","download_url":"https://codeload.github.com/Meqn/diy-log/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219843287,"owners_count":16556508,"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":["console","log","log-symbols","logger","logging","terminal"],"created_at":"2024-10-15T16:43:43.457Z","updated_at":"2025-02-26T01:33:05.808Z","avatar_url":"https://github.com/Meqn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# diy-log 🌈\n\n[![version](https://img.shields.io/npm/v/diy-log?style=flat-square)](https://www.npmjs.com/package/diy-log)\n[![Codecov](https://img.shields.io/codecov/c/github/Marinerer/diy-log?token=HYQ5I268HN\u0026style=flat-square\u0026logo=codecov)](https://codecov.io/gh/Marinerer/diy-log)\n[![release](https://img.shields.io/github/actions/workflow/status/Marinerer/diy-log/release.yml?style=flat-square)](https://github.com/Marinerer/pipflow/releases)\n[![node.js](https://img.shields.io/node/v/diy-log?style=flat-square\u0026logo=nodedotjs)](https://nodejs.org/en/about/releases/)\n[![languages](https://img.shields.io/github/languages/top/Marinerer/diy-log?style=flat-square)](https://github.com/Marinerer/diy-log)\n[![downloads](https://img.shields.io/npm/dm/diy-log?style=flat-square)](https://www.npmjs.com/package/diy-log)\n\n\n\n\u003e Various console log level prefixes with support for color symbols and tags.\n\n自定义控制台各种级别日志输出的前缀，支持颜色符号，标签和时间。\n\n\n![img](./example/screenshot.png)\n\n\n\n## Installation\n\n```bash\nnpm install diy-log --save-dev\n```\n\n\n\n## Usage\n\n```js\n// for cjs\nconst logger = require('diy-log')\nconst { log, symbols, colors, tag } = logger\n\n\n// for esm\nimport logger, {\n  log,\n  colors,\n  symbols,\n  tag\n} from 'diy-log'\n```\n\n```js\ntime('time ...')\n\ninfo('info ...')\ndone('done ...')\nerror('error ...')\nwarn('warn ...')\n\nlog(symbols.info, 'info ...')\nlog(symbols.done, 'done ...')\nlog(symbols.error, 'error ...')\nlog(symbols.warn, 'warn ...')\n\n\nlog(colors.dim('dim:text;'))\nlog(colors.blue('color: blue;'))\nlog(colors.bgGreen('bgcolor: green;'))\nlog(colors.bold('bold:text;'))\nlog(colors.italic('italic:text;'))\nlog(colors.underline('underline:text;'))\n\n\ntag('info message')\ntag('success message', 'done', 'success')\ntag.warn('warning message')\ntag.done('done message')\ntag.info(colors.blue('info message'))\ntag.error('error message')\n```\n\n## Methods\n\n```ts\ntype Log = (...args: any[]) =\u003e void\n\ntype TagType = (message: string, label?: string) =\u003e void\n\ninterface Tag {\n  (message: string, tag: 'info' | 'error' | 'done' | 'warn' = 'info', label?: string): void\n  info: TagType\n  error: TagType\n  done: TagType\n  warn: TagType\n}\n```\n\n- `log`: Log;\n- `time`: Log;\n- `info`: Log;\n- `error`: Log;\n- `done`: Log;\n- `warn`: Log;\n- `tag`: Tag;\n- `tag.info`: TagType;\n- `tag.error`: TagType;\n- `tag.done`: TagType;\n- `tag.warn`: TagType;\n\n\n## Thanks\n\n[log-symbols](https://github.com/sindresorhus/log-symbols) , [picocolors](https://github.com/alexeyraspopov/picocolors) , [time-stamp](https://github.com/jonschlinkert/time-stamp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMarinerer%2Fdiy-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMarinerer%2Fdiy-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMarinerer%2Fdiy-log/lists"}