{"id":21414868,"url":"https://github.com/magic/log","last_synced_at":"2025-07-06T13:06:24.504Z","repository":{"id":54292697,"uuid":"53756148","full_name":"magic/log","owner":"magic","description":"console.log + loglevels","archived":false,"fork":false,"pushed_at":"2023-02-16T07:32:55.000Z","size":1301,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T05:28:20.976Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magic.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":"2016-03-12T22:22:57.000Z","updated_at":"2021-12-26T18:14:32.000Z","dependencies_parsed_at":"2024-10-30T03:24:46.320Z","dependency_job_id":null,"html_url":"https://github.com/magic/log","commit_stats":{"total_commits":353,"total_committers":3,"mean_commits":"117.66666666666667","dds":0.1076487252124646,"last_synced_commit":"435d6cc18d696f98abffabb47fae62b1f4f00d7d"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Flog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Flog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Flog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Flog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magic","download_url":"https://codeload.github.com/magic/log/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Flog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258892896,"owners_count":22773914,"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-22T18:34:06.862Z","updated_at":"2025-07-06T13:06:24.484Z","avatar_url":"https://github.com/magic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @magic/log\n\nsimple server side logging.\n\nbasically console.log + loglevels + process.env awareness\n\n[html-docs](https://magic.github.io/log)\n\n[![NPM version][npm-image]][npm-url]\n[![Linux Build Status][travis-image]][travis-url]\n[![Windows Build Status][appveyor-image]][appveyor-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n[![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n\n[npm-image]: https://img.shields.io/npm/v/@magic/log.svg\n[npm-url]: https://www.npmjs.com/package/@magic/log\n[travis-image]: https://img.shields.io/travis/com/magic/log/master\n[travis-url]: https://travis-ci.com/magic/log\n[appveyor-image]: https://img.shields.io/appveyor/ci/magic/log/master.svg\n[appveyor-url]: https://ci.appveyor.com/project/magic/log/branch/master\n[coveralls-image]: https://coveralls.io/repos/github/magic/log/badge.svg\n[coveralls-url]: https://coveralls.io/github/magic/log\n[greenkeeper-image]: https://badges.greenkeeper.io/magic/log.svg\n[greenkeeper-url]: https://badges.greenkeeper.io/magic/log.svg\n[snyk-image]: https://snyk.io/test/github/magic/log/badge.svg\n[snyk-url]: https://snyk.io/test/github/magic/log\n\n#### installation:\n\n```javascript\n  npm install @magic/log\n```\n\n#### usage:\n\n##### import\n\n```javascript\nimport log from '@magic/log'\n```\n\n##### log levels\n\n```javascript\n// set logLevel to all\nlog.setLevel('all')\nlog.setLevel(0)\n\n// logLevel warn\nlog.setLevel('warn')\nlog.setLevel(1)\n\n// only log errors:\nlog.setLevel('error')\nlog.setLevel(2)\n\n// if production, set logLevel to \"warn\", if development, \"all\"\nlog.resetLevel()\n\n// get current logLevel\nlog.getLevel()\n```\n\n##### log functions\n\n```javascript\n// only outputs if logLevel === 'all'\nlog.info('Some interesting yet useless information')\n\n// only outputs if logLevel === 'all'.\n// output of first argument is green.\nlog.success('yay', 'only the first', 'argument was green')\n\n// always outputs. first argument will be red\nlog.error('ERROR:', 'error messsage')\n\n// outputs if logLevel === 'warn' || 'all'\nlog.warn('WARN:', 'warn message')\n\n// make a message greyed out\nlog.annotate('Annotate this message')\n\n// return process.hrtime to use in log.timeTaken\nconst start = log.hrtime()\n\n// get delta between one hrtime and another\nconst delta = log.hrtime(start)\n\n// print the s, ms or ns since start\nlog.timeTaken(start, 'before', 'after')\n// logs 'before xns after'\n```\n\n##### changelog\n\n#####v0.0.3\nlog.error now converts errors for better logging\n\n#### 0.1.0\n\nuse ecmascript modules\n\n#### 0.1.1\n\nbump to get this version to be the default for install.\n0.1.0-cjs was preferred, but is deprecated.\n\n#### 0.1.2\n\nadd log.hrtime and log.timeTaken\n\n#### 0.1.3\n\nrequire node \u003e= 13.5.0\n\n#### 0.1.4\n\nlog.timeTaken(time, pre, post):\nif pre ends and post starts with a string delimiter,\nthe time value between those string delimiters does not get spaces added around it.\n\n#### 0.1.5\n\nbump required node version to 14.2.0\n\n#### 0.1.6\n\nupdate dependencies\n\n#### 0.1.7\n\nchange log.level initialization\n\n#### 0.1.8\n\n- bump required node version to 14.15.4\n- update dependencies\n\n##### 0.1.9\n\nupdate dependencies\n\n##### 0.1.10\n\nupdate @magic/types to avoid circular dependency\n\n##### 0.1.11\n\n- log.timeTaken now takes a config object as second parameter, `log.timeTaken(time, { pre: '', post: '', log: true })`. three argument call is possible too: `log.timeTaken(time, pre, post, log)`\n- update dependencies\n\n##### 0.1.12\n\nupdate dependencies\n\n##### 0.1.13\n\nremove unwanted log from log.timeTaken\n\n##### 0.1.14\n\n- update dependencies\n- log.timeTaken now also returns μs if needed\n\n##### 0.1.15\n\nupdate dependencies\n\n##### 0.1.16\n\nupdate dependencies\n\n##### 0.1.17\n\nupdate dependencies\n\n##### 0.1.18\n\nupdate dependencies\n\n##### 0.1.19 - unreleased\n\n...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagic%2Flog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagic%2Flog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagic%2Flog/lists"}