{"id":18522886,"url":"https://github.com/avine/ns-logger","last_synced_at":"2026-04-29T09:04:38.492Z","repository":{"id":57099966,"uuid":"144488014","full_name":"avine/ns-logger","owner":"avine","description":" Logger with namespace support for node and browser","archived":false,"fork":false,"pushed_at":"2018-12-19T11:36:41.000Z","size":222,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-28T19:36:22.673Z","etag":null,"topics":["browser","log","logger","logging","module","namespace","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://avine.github.io/ns-logger/","language":"TypeScript","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/avine.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}},"created_at":"2018-08-12T17:42:45.000Z","updated_at":"2018-12-19T11:36:43.000Z","dependencies_parsed_at":"2022-08-22T23:10:42.893Z","dependency_job_id":null,"html_url":"https://github.com/avine/ns-logger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/avine/ns-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avine%2Fns-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avine%2Fns-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avine%2Fns-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avine%2Fns-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avine","download_url":"https://codeload.github.com/avine/ns-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avine%2Fns-logger/sbom","scorecard":{"id":218302,"data":{"date":"2025-08-11","repo":{"name":"github.com/avine/ns-logger","commit":"a6bb03b46c6608f2620bd3743781a27143248f80"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"43 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-9q64-mpxx-87fg","Warn: Project is vulnerable to: GHSA-jc84-3g44-wf2q","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-6x33-pw7p-hmpq","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-675m-85rw-j3w4","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T02:03:07.940Z","repository_id":57099966,"created_at":"2025-08-17T02:03:07.940Z","updated_at":"2025-08-17T02:03:07.940Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32418188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["browser","log","logger","logging","module","namespace","nodejs","typescript"],"created_at":"2024-11-06T17:33:21.150Z","updated_at":"2026-04-29T09:04:38.473Z","avatar_url":"https://github.com/avine.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ns-logger\n\nLogger with namespace support for node and browser\n\n[![Build Status](https://travis-ci.org/avine/ns-logger.svg?branch=master)](https://travis-ci.org/avine/ns-logger)\n\n## Usage\n\n### Get logger\n\nBy default, only `warn` and `error` severity levels are displayed in the console.\n\n```js\nimport { getLogger } from '@avine/ns-logger';\n\nconst logger = getLogger('MyNamespace');\n\nlogger.trace('Trace hidden');\nlogger.log('Log hidden');\nlogger.warn('Warn visible');\nlogger.error('Error visible');\n```\n\n*Console output:*\n\n```console\n[MyNamespace] Warn visible\n[MyNamespace] Error visible\n```\n\nAs you can see, the logs are prefixed by the namespace.\n\n### Check enabled severity levels\n\nDetermine whether a severity level is enabled, by checking the `enabled` readonly property.\n\n```js\nimport { getLogger } from '@avine/ns-logger';\n\nconst logger = getLogger('MyNamespace');\n\nconsole.log('Trace:', logger.trace.enabled);\nconsole.log('Log:', logger.log.enabled);\nconsole.log('Warn:', logger.warn.enabled);\nconsole.log('Error:', logger.error.enabled);\n```\n\n*Console output:*\n\n```console\nTrace: false\nLog: false\nWarn: true\nError: true\n```\n\n### Change severity level of logger instance\n\nTo change the severity level of logger instance programmatically, set its `level` property using the `Level` enum:\n\n```ts\nexport enum Level {\n  Trace,  // (= 0)\n  Log,    // (= 1)\n  Warn,   // (= 2)\n  Error,  // (= 3)\n  Silent  // (= 4)\n}\n```\n\nHere's how to use it:\n\n```js\nimport { getLogger, Level } from '@avine/ns-logger';\n\nconst logger = getLogger('MyNamespace');\n\nlogger.level = Level.Log; // Using Level enum\n\nlogger.trace('Trace hidden');\nlogger.log('Log NOW visible!');\nlogger.warn('Warn visible');\nlogger.error('Error visible');\n\nlogger.level = 4; // Using literal number\n\nlogger.trace('Trace hidden...');\nlogger.log('Log hidden...');\nlogger.warn('Warn hidden...');\nlogger.error('Error hidden...');\n```\n\n*Console output:*\n\n```console\n[MyNamespace] Log NOW visible!\n[MyNamespace] Warn visible\n[MyNamespace] Error visible\n```\n\n### Change default severity level\n\n`NsLogger` keeps track of instantiated loggers.\nExisting loggers are NOT affected by new default level setting.\nOnly fresh created loggers are affected.\n\n```js\nimport { getLogger, setDefaultLevel, Level } from '@avine/ns-logger';\n\nconst a = getLogger('NamespaceA'); // a.level === Level.Warn\n\nsetDefaultLevel(Level.Log);\n\nconst b = getLogger('NamespaceB'); // b.level === Level.Log\n\nsetDefaultLevel(Level.Error);\n\nconst aAlias = getLogger('NamespaceA'); // a.level is still Level.Warn\nconst bAlias = getLogger('NamespaceB'); // b.level is still Level.Log\nconst c = getLogger('NamespaceC'); // Only c.level is Level.Error\n\naAlias.warn('aAlias === a ?', aAlias === a);\nbAlias.warn('bAlias === b ?', bAlias === b);\n\na.warn('level:', a.level);\nb.log('level:', b.level);\nc.error('level:', c.level);\n```\n\n*Console output:*\n\n```console\n[NamespaceA] aAlias === a ? true\n[NamespaceB] bAlias === b ? true\n[NamespaceA] level: 2\n[NamespaceB] level: 1\n[NamespaceC] level: 3\n```\n\n### Configure severity level of loggers from `state` object\n\nTo configure the severity level of loggers to be instantiated in a declarative way, use the `state.level` object.\n\n```ts\ninterface ILevelState {\n  [namespace: string]: Level;\n}\n```\n\nThe namespace key has the following pattern `[Module]:[Feature]`.\n\nYou can use the symbol `*` as a wildcard to target all features of a module like this: `[Module]:*`.\n\nIn the same way, you can use this symbol to target all modules and features (this is like overwriting the default severity level declaratively).\n\n```js\nimport { getLogger, state } from '@avine/ns-logger';\n\nstate.level = {\n  'ModuleA:Feature1': 0,\n  'ModuleA:Feature2': 1,\n  'ModuleA:*': 2, // Wildcard for all features of a module\n  'ModuleB': 3,\n  '*': 4, // Wildcard for all modules and features\n};\n\nconsole.log(\n  getLogger('ModuleA:Feature1').level,\n  getLogger('ModuleA:Feature2').level,\n  getLogger('ModuleA:Feature3').level, // Matches 'ModuleA:*'\n  getLogger('ModuleB').level,\n  getLogger('ModuleC').level, // Matches '*'\n);\n```\n\n*Console output:*\n\n```console\n0 1 2 3 4\n```\n\n### Configure severity level of loggers from `localStorage`\n\nIn the brower, you can set the `state.level` object using `localStorage.NsLogger`.\n\nThe `NsLogger` property has following pattern: `[Module]:[Feature] = [Level]; ...`\n\nTo get the same result as above, enter the following line in the browser console and reload the page:\n\n```console\nlocalStorage.NsLogger = 'ModuleA:Feature1 = 0; ModuleA:Feature2 = 1; ModuleA:* = 2; ModuleB = 3; * = 4;';\n```\n\n## Browser support\n\n`NsLogger` supports all major browsers (including IE11).\n\nYou can use the script\n[https://unpkg.com/@avine/ns-logger/ns-logger.js](https://unpkg.com/@avine/ns-logger/ns-logger.js)\nthat exposes the package as the global variable `NsLogger`.\n\n```html\n\u003cscript src=\"https://unpkg.com/@avine/ns-logger/ns-logger.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  const logger = NsLogger.getLogger('MyNamespace');\n  logger.warn('Cool!'); // [MyNamespace] Cool!\n\u003c/script\u003e\n```\n\nYou can also import the package in your code and bundle your application with `webpack` for example or any other bundler of your choice.\n\n```js\nimport { getLogger } from '@avine/ns-logger';\n\n// Your code...\n```\n\nFor a live preview, check out this [demo](https://avine.github.io/ns-logger/) in your favorite browser.\n\n## Plugins\n\n### Chalk-plugin\n\nThis plugin is designed for use in node (not  in the browser) and uses\n[Chalk](https://www.npmjs.com/package/chalk)\npackage to style the logs prefix depending on the severity level.\n\n```js\nimport '@avine/ns-logger/chalk-plugin';\nimport { getLogger } from '@avine/ns-logger';\n\nconst logger = getLogger('MyNamespace');\nlogger.error('Message...');\n```\n\n*Console output:*\n\n```console\n[MyNamespace] Message...\n```\n\nThe string `[MyNamespace]` will appear in red color in the console (trust me :-).\n\n## Contribute\n\n`NsLogger` is written in TypeScript, and that's the fun part.\n\n```bash\ngit clone https://github.com/avine/ns-logger.git\n\ncd ./ns-logger\n\nnpm install\n\nnpm run all # npm run lint \u0026\u0026 npm test \u0026\u0026 npm run build\n\nnpm start # this will launch a demo in your favorite browser\n```\n\n## License\n\nMIT @ [Avine](https://avine.io)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favine%2Fns-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favine%2Fns-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favine%2Fns-logger/lists"}