Logging — Techniques · NestJS

Log through Nest's Logger with a class context, then make the application use a logger of your own that extends ConsoleLogger and keeps what it prints, with the boot log buffered until it exists.

What you will learn

Read the theory for Logging

All Techniques lessons

All NestJS courses

loading types…

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