Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enigmatis/polaris-nest-logger
Use polaris-logs in your nestjs app easily!
https://github.com/enigmatis/polaris-nest-logger
logger nestjs polaris-logs winston
Last synced: 1 day ago
JSON representation
Use polaris-logs in your nestjs app easily!
- Host: GitHub
- URL: https://github.com/enigmatis/polaris-nest-logger
- Owner: Enigmatis
- Created: 2020-04-20T08:42:06.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:50:47.000Z (about 2 years ago)
- Last Synced: 2025-01-28T23:14:32.252Z (1 day ago)
- Topics: logger, nestjs, polaris-logs, winston
- Language: TypeScript
- Homepage:
- Size: 1.22 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
Use polaris-logs easily in nestjs apps!
# polaris-nest-logger
Want to use polaris-logger in your nest js app?
You are welcome to use our PolarisNestLoggerModule!
### Getting started
- This module has to be used in a nestjs project, so make sure you have one, and that you have installed `@nestjs/core` & `@nestjs/common`
- run `npm install @enigmatis/polaris-nest-logger`### Using the module
In your `app.module`, import the `PolarisNestLoggerModule` in one of the following ways:
#### using `register` method:
```javascript
@Module({
imports: [PolarisNestLoggerModule.register(polarisNestLoggerOptions)],
})
export class AppModule{}
```
The options argument should be of type `PolarisNestLoggerOptions`.#### using `registerAsync` method:
With `registerAsync` method you can provide a factory method that will return your configuration, so that the configuration can be generated dynamically using your own providers. For example:
```javascript
@Module({
imports: [
PolarisNestLoggerModule.registerAsync({
imports: [CommonModule],
inject: [ApiConfigService],
useFactory: async (apiConfigService: ApiConfigService): Promise => {
const applicationProperties: ApplicationProperties = apiConfigService.config.app;
const loggerConfiguration: LoggerConfiguration = {...apiConfigService.config.logger, loggerLevel: apiConfigService.config.logger.level};
return {applicationProperties, loggerConfiguration};
}
})
],
})
export class AppModule{}
```