How to use Ogma logger with Nest Commander in main.ts
?
#884
Answered
by
jmcdo29
tukusejssirs
asked this question in
Q&A
-
In |
Beta Was this translation helpful? Give feedback.
Answered by
jmcdo29
May 1, 2023
Replies: 1 comment 7 replies
-
Any logger that satisfies Nest's async function bootstrap() {
const app = await CommandFactory.createWithoutRunning(AppModule);
app.useLogger(app.get(OgmaService)); // assuming `OgmaModule.forRoot()` has been imported
await CommandFactory.runApplication(app);
}
bootstrap(); |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
tukusejssirs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any logger that satisfies Nest's
logger
property is valid, however using ogma directly for that isn't always nice to have to instantiate theOgma
instance yourself, so instead with v3.7.0 you can do something likeDocs on the createWithoutRunning