{"id":15292026,"url":"https://github.com/devsheva/simplelog","last_synced_at":"2025-07-04T15:37:21.920Z","repository":{"id":255461329,"uuid":"850402799","full_name":"devsheva/simplelog","owner":"devsheva","description":"A simple logger decorator amplify like","archived":false,"fork":false,"pushed_at":"2025-04-19T14:18:55.000Z","size":281,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T15:37:17.789Z","etag":null,"topics":["decorators","logging","nodejs","npm","typescript"],"latest_commit_sha":null,"homepage":"","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/devsheva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-08-31T17:09:41.000Z","updated_at":"2025-04-19T14:18:29.000Z","dependencies_parsed_at":"2024-10-24T22:14:42.249Z","dependency_job_id":"25fd5093-f304-495c-a538-38a2dc444e30","html_url":"https://github.com/devsheva/simplelog","commit_stats":null,"previous_names":["devsheva/simplelog"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/devsheva/simplelog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsheva%2Fsimplelog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsheva%2Fsimplelog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsheva%2Fsimplelog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsheva%2Fsimplelog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devsheva","download_url":"https://codeload.github.com/devsheva/simplelog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsheva%2Fsimplelog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263568094,"owners_count":23481613,"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":["decorators","logging","nodejs","npm","typescript"],"created_at":"2024-09-30T16:16:12.947Z","updated_at":"2025-07-04T15:37:21.901Z","avatar_url":"https://github.com/devsheva.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simplelog-decorator\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/devsheva/simplelog/qa.yml)\n[![NPM Version](https://img.shields.io/npm/v/simplelog-decorator)](https://www.npmjs.com/package/simplelog-decorator)\n![NPM Downloads](https://img.shields.io/npm/dm/simplelog-decorator?style=plastic)\n[![Codecov](https://img.shields.io/codecov/c/github/devsheva/simplelog)](https://app.codecov.io/github/devsheva/simplelog)\n\nA simple logger built as class decorator, amplify like.\n\n## Quick Start\n\n### Usage\n\nDue to the experimental decorators feature, there are some limitations.\nStarting from the preferred syntax `@Logger()`\n\nIn TypeScript you need to simply enable `experimentalDecorators: true` in your `tsconfig.json`, to be able to use the preferred syntax.\n\nIn JavaScript you need to use external libraries like [@babel/plugin-proposal-decorators](https://www.npmjs.com/package/@babel/plugin-proposal-decorators) to use the preferred syntax.\n\nAnyway since a decorator is just a function, you can use it by importing the `loggerDecorator` method.\n\nArguments of logger are:\n\n- `name`: optional, default value is name of class\n- `options`:\n  - `level`: default to `info`\n\n```ts\nimport Logger, {loggerDecorator} from 'simplelog-decorator'\n\n// @Logger('YourCustomClass')\n// @Logger('YourCustomClass', {level: 'warn'})\n// loggerDecorator()(YourClass) \n@Logger() // name will be YourClass, level info\nclass YourClass {\n   sample_method() {\n      this.logger.verbose('hi from sample_method')\n      this.logger.debug('hi from sample_method')\n      this.logger.info('hi from sample_method')\n      this.logger.warn('hi from sample_method')\n      this.logger.error('hi from sample_method')\n\n   }\n}\n\n\n```\n\n## Limitations\n\nAs previously said, **experimental decorators** are used for this package implementation and since experimental it has some bugs like `unsafe typing`.\nTypeScript compiler complains when it finds out a property used inside a class that calls a decorator cause it cannot infer it, so as a temporary workaround simply declare an interface\n\n```ts\ninterface Example {logger: any}\n\n@Logger()\nclass Example {\n   hello() {\n    this.logger.debug() // THIS IS VALID\n   }\n}\n```\n\n## Contributing\n\nThis has been developed as a personal project, in order to be able to have an amplify-like logger as a package, without needing to install the whole amplify lib for just logging features.\n\nBut feel free to contribute by forking this project and opening a PR once done.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsheva%2Fsimplelog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevsheva%2Fsimplelog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsheva%2Fsimplelog/lists"}