Files
main.tsmain
What you'll learn
- Log from a class through new Logger(ClassName.name), at the right level, in Nest's own format
- Extend ConsoleLogger, keep its output and add behaviour, and install it with app.useLogger() from the container
- Explain what bufferLogs does and why the boot log is lost without it
Press Run tests to start the app. Its log appears here.Graded endpoints
Buffered during boot and flushed through ShelterLogger once useLogger ran
Every mapped route was logged through the same logger
The service logs the creation
The service warns before throwing
new Logger(CatsService.name) forwarded to the installed logger, with the class as context and the levels kept
The level was recorded with each entry