{"_id":"@amplication/util-nestjs-logging","_rev":"2-7cc20f685f16023ec9048c1c9b8cf322","name":"@amplication/util-nestjs-logging","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@amplication/util-nestjs-logging","version":"0.0.1","author":{"url":"https://amplication.com","name":"Amplication","email":"contact@amplication.com"},"_id":"@amplication/util-nestjs-logging@0.0.1","maintainers":[{"name":"amplication-bot","email":"engineering@amplication.com"},{"name":"mulygottlieb","email":"muly@amplication.com"},{"name":"levivannoort","email":"vanNoort.levi@protonmail.com"},{"name":"overbit","email":"daniele.iasella@gmail.com"},{"name":"morhag","email":"mor@amplication.com"},{"name":"amitbarletz","email":"amit@amplication.com"},{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"}],"dist":{"shasum":"817fde396fd76e14bd6defe0561d1b040b75c8bc","tarball":"https://registry.npmjs.org/@amplication/util-nestjs-logging/-/util-nestjs-logging-0.0.1.tgz","fileCount":14,"integrity":"sha512-zkTf0JPWDisg6Dczu6/m/nQ45ewTJcW3AS4xuQ5IqomsOVIv7Txbz5TAmrc1HTYxd4kLw2KVnu4uaPCBByBSlQ==","signatures":[{"sig":"MEUCIQDciZwNjs/IvAWlFsKYG+9aYksQvA7NRwHKHy+9e1PvjQIgGM4Wer9qV0PclxV3uvv9cZ27seCxpxW6vdqNm7y0YXo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11386},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"1e2677e3f850375217bffeec53186b4c4c35ddcd","_npmUser":{"name":"mulygottlieb","email":"muly@amplication.com"},"_npmVersion":"9.8.1","description":"This library supplies a logger for Amplication Services","directories":{},"_nodeVersion":"18.18.0","dependencies":{"util":"0.12.5","tslib":"^2.6.2","logform":"2.6.1","winston":"3.8.2","triple-beam":"1.4.1","@nestjs/common":"^9.4.0","@amplication/util-logging":"0.0.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/util-nestjs-logging_0.0.1_1724770942350_0.5741965531445798","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-08-27T15:02:22.269Z","modified":"2024-09-09T13:32:51.446Z","0.0.1":"2024-08-27T15:02:22.530Z"},"author":{"url":"https://amplication.com","name":"Amplication","email":"contact@amplication.com"},"description":"This library supplies a logger for Amplication Services","maintainers":[{"email":"engineering@amplication.com","name":"amplication-bot"},{"email":"muly@amplication.com","name":"mulygottlieb"},{"email":"vanNoort.levi@protonmail.com","name":"levivannoort"},{"email":"mor@amplication.com","name":"morhag"},{"email":"hazaz.yuval@gmail.com","name":"yuvalhazaz"}],"readme":"# Amplication NestJS Logger Module\n\nThe `@amplication/util/nestjs/logging` is our official logger module. This library leverage, under the hood, the framework-agnostic amplication logging library `@amplication/util/logging`.\n\nAll nestjs services at Amplication must use this library to ensure consistent logging. This will enable us to trace and observe our systems reliably.\n\n## Getting started\n\n### Consume the module\n\nIn your microservices, import the logger module and consume it in your root module.\n\n```ts\n// app.module.ts\n\nimport { AmplicationLoggerModule } from '@amplication/util/nestjs/logging';\n\n@Module({\n  imports: [\n    //...\n    AmplicationLoggerModule.forRoot({\n      component: SERVICE_NAME,\n    }),\n    //...\n  ],\n})\nexport class AppModule implements // ....\n```\n\nThe minimum log level can be configured also with the `LOG_LEVEL` environment variable, instead of the `logLevel: LogLevel.Warn`, to one of the following values:\n- `debug`\n- `info`\n- `warn`\n- `error`\n\n\n### Usage\n\nYou can import the logger via dependency injection.\n\n```ts\n// example.service.ts\n\nimport {\n  AmplicationLogger,\n} from \"@amplication/util/nestjs/logging\";\n\n@Injectable()\nexport class ExampleService {\n  constructor(\n    @Inject(AmplicationLogger)\n    private readonly logger: AmplicationLogger\n  ) {}\n\n  someMethod() {\n    this.logger.debug(\"This is a debug log\", { some: \"context\" });\n    this.logger.info(\"This is a info log\", { some: \"context\" });\n    this.logger.warn(\"This is a warn log\", { some: \"context\" });\n    this.logger.error(\"This is a error log\", { some: \"context\" });\n  }\n}\n```\n\n\n## Testing utils\n\nA mocked provider can be used in unit tests. \nThe following example explain how to use it\n\n```ts\n/// myservice.spec.ts\n\nimport { MockedAmplicationLoggerProvider } from \"@amplication/util/nestjs/logging/test-utils\";\n\n//...\n const module: TestingModule = await Test.createTestingModule({\n      providers: [\n        // ... \n        MockedAmplicationLoggerProvider,\n        // ...\n      ]\n      //...\n }).compile();\n//...\n```","readmeFilename":"README.md"}