-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from WildEgor/develop
release: fix logger init
- Loading branch information
Showing
6 changed files
with
97 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
import { LoggerAdapter } from '@wildegor/nestjs-prologger/modules/modules/logger/logger.adapter'; | ||
import { LoggerConstants } from '@wildegor/nestjs-prologger/modules/modules/logger/logger.constants'; | ||
import { LogLevels } from '@wildegor/nestjs-prologger/modules/infrastructure/interfaces/logger.interfaces'; | ||
import { LoggerAdapter } from '../../../src/modules/logger/logger.adapter'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
const app = await NestFactory.create(AppModule, { | ||
bufferLogs: true, | ||
}); | ||
|
||
const logger = app.get<LoggerAdapter>(LoggerConstants.logger); | ||
const logger = app.get<LoggerAdapter>(LoggerAdapter); | ||
logger.setLogLevels([ | ||
LogLevels.Debug, | ||
LogLevels.Log, | ||
LogLevels.Warn, | ||
LogLevels.Verbose, | ||
]); | ||
|
||
app.useLogger(logger); | ||
|
||
logger.error('Error message'); | ||
|
||
throw Error('Error message'); | ||
|
||
await app.listen(3001); | ||
} | ||
bootstrap(); |
26 changes: 17 additions & 9 deletions
26
src/infrastructure/adapters/winston/transports/console/console.transport.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters