| ✅ Logs | ✖️ Metrics | ✖️ Traces |
Getting started
ImportHyperDXNestLoggerModule into the root AppModule and use the forRoot()
method to configure it.
HDX_LOGGER_MODULE_PROVIDER injection token:
Replacing the Nest logger (also for bootstrapping)
ImportantBy doing this, you give up the dependency injection, meaning that
forRoot and forRootAsync aren’t needed and shouldn’t be used. Remove them from your main module.HyperDXNestLogger isn’t yet
available, which means that Nest falls back to the internal logger.
One solution is to create the logger outside of the application lifecycle, using
the createLogger function, and pass it to NestFactory.create. Nest will then
wrap our custom logger (the same instance returned by the createLogger method)
into the Logger class, forwarding all calls to it:
Create the logger in the main.ts file
@nestjs/common: