{"id":20723277,"url":"https://github.com/rmagatti/autoreggol","last_synced_at":"2025-04-23T17:26:52.958Z","repository":{"id":39579196,"uuid":"342808304","full_name":"rmagatti/autoreggol","owner":"rmagatti","description":"A collection of handy decorators for auto logging class methods and properties.","archived":false,"fork":false,"pushed_at":"2023-12-21T20:18:00.000Z","size":420,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T13:00:39.246Z","etag":null,"topics":["hacktoberfest","npm-package","typescript","typescript-decorators"],"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/rmagatti.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}},"created_at":"2021-02-27T08:33:32.000Z","updated_at":"2024-02-09T09:30:59.000Z","dependencies_parsed_at":"2024-11-17T04:08:24.344Z","dependency_job_id":"b33c8092-e72b-4ba2-8b33-b4265b56d51f","html_url":"https://github.com/rmagatti/autoreggol","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":0.02777777777777779,"last_synced_commit":"c801cd222511e84120f38917dd8e3173350dd716"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmagatti%2Fautoreggol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmagatti%2Fautoreggol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmagatti%2Fautoreggol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmagatti%2Fautoreggol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmagatti","download_url":"https://codeload.github.com/rmagatti/autoreggol/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250479484,"owners_count":21437371,"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":["hacktoberfest","npm-package","typescript","typescript-decorators"],"created_at":"2024-11-17T04:08:10.105Z","updated_at":"2025-04-23T17:26:52.935Z","avatar_url":"https://github.com/rmagatti.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto Reggol\n\nA collection of handy decorators for auto logging class methods and properties based on es6 proxies and reflect-metadata.\n\n## Usage\n\nProvide a `LogFunction` for auto reggol to call.\n\n```typescript\nconst logger: LogFunction = (ctr, targetKey, targetValue, level) =\u003e {\n  console.log(`${level}: ${ctr.name}.${targetKey.toString()}`, targetValue);\n};\n```\n\nPass the logger function into the `@AutoLog` decorator.\n\n```typescript\n@AutoLog({ logger, level: \"debug\", enablePropertyLogging: true })\nclass Example {}\n```\n\nFull example\n\n```typescript\nimport { AutoLog } from \"../src\";\nimport { LogFunction } from \"../src/base\";\nimport { AutoLogLevel, AutoLogBypass } from \"../src/method-decorators\";\nimport {\n  AutoLogPropBypass,\n  AutoLogPropLevel,\n} from \"../src/property-decorators\";\n\nconst logger: LogFunction = (ctr, targetKey, targetValue, level) =\u003e {\n  console.log(`${level}: ${ctr.name}.${targetKey.toString()}`, targetValue);\n};\n\n@AutoLog({ logger, level: \"debug\", enablePropertyLogging: true })\nclass Example {\n  private a = \"foo\";\n  private b = \"bar\";\n  @AutoLogPropLevel(\"warn\")\n  private c = \"baz\";\n\n  private d = \"qux\";\n  private e = \"quuz\";\n\n  @AutoLogPropBypass\n  private f = \"corge\";\n\n  @AutoLogLevel(\"info\")\n  private sanitize(str: string): string {\n    this.d;\n    this.e;\n    this.f;\n\n    return `A String ${str}`;\n  }\n\n  @AutoLogBypass\n  private doSomething(str: string): string {\n    this.d;\n    this.e;\n    this.f;\n\n    return `A String ${str}`;\n  }\n\n  run(args: { a: string; b: string }): string {\n    this.a;\n    this.b;\n    this.c;\n\n    this.doSomething(\"something\");\n\n    return this.sanitize(args.a);\n  }\n}\n\nconst example = new Example();\n\nexample.run({ a: \"Hello\", b: \"World\" });\n\nclass NonLoggedClass {\n  iDontLog() {\n    return \"not me\";\n  }\n\n  @AutoLogMe(logger)\n  iDoLog(argument: string) {\n    return `me please ${argument}`;\n  }\n}\n\nconst nonLoggedClass = new NonLoggedClass();\n\nnonLoggedClass.iDontLog();\nnonLoggedClass.iDoLog(\"arg1\");\n```\n\nResult\n\n```\ndebug: Example.run [ { a: 'Hello', b: 'World' } ]\ndebug: Example.a foo\ndebug: Example.b bar\nwarn: Example.c baz\ndebug: Example.d qux\ndebug: Example.e quuz\ninfo: Example.sanitize [ 'Hello' ]\ndebug: Example.d qux\ndebug: Example.e quuz\ninfo: NonLoggedClass.iDoLog [ 'arg1' ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmagatti%2Fautoreggol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmagatti%2Fautoreggol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmagatti%2Fautoreggol/lists"}