File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { LoggerService } from './../services/logger.service' ;
12import { Type } from './type.interface' ;
23
34export interface INestApplicationContext {
@@ -18,8 +19,13 @@ export interface INestApplicationContext {
1819
1920 /**
2021 * Terminates the application
21- *
2222 * @returns {Promise<void> }
2323 */
2424 close ( ) : Promise < void > ;
25+
26+ /**
27+ * Sets custom logger service
28+ * @returns {void }
29+ */
30+ useLogger ( logger : LoggerService ) ;
2531}
Original file line number Diff line number Diff line change 11import {
22 INestApplicationContext ,
3+ Logger ,
4+ LoggerService ,
35 OnModuleDestroy ,
46 OnModuleInit ,
57} from '@nestjs/common' ;
@@ -64,6 +66,10 @@ export class NestApplicationContext extends ModuleRef
6466 await this . callDestroyHook ( ) ;
6567 }
6668
69+ public useLogger ( logger : LoggerService ) {
70+ Logger . overrideLogger ( logger ) ;
71+ }
72+
6773 protected async callInitHook ( ) : Promise < any > {
6874 const modules = this . container . getModules ( ) ;
6975 await Promise . all (
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ export class NestFactoryStatic {
175175 }
176176
177177 private applyLogger ( options : NestApplicationContextOptions | undefined ) {
178- if ( ! options || ! options . logger ) {
178+ if ( ! options ) {
179179 return ;
180180 }
181181 Logger . overrideLogger ( options . logger ) ;
You can’t perform that action at this time.
0 commit comments