@@ -175,14 +175,17 @@ export class Knight {
175175 * create a new web server and connect controllers in the local project.
176176 * @returns A web server that can be started
177177 */
178- public static async build ( ) : Promise < Application > {
178+ public static async build ( logger ?: Logger ) : Promise < Application > {
179179 const app = new Application ( ) ;
180180 const router = new Router ( ) ;
181181
182182 // Register all controllers
183+ if ( logger ) {
184+ logger . debug ( `Searching for controllers in ${ Deno . cwd ( ) } ` ) ;
185+ }
183186 const controllers = await this . findLocalControllersIn ( Deno . cwd ( ) ) ;
184- if ( this . _mode == AppMode . DEV ) {
185- console . log ( `Found ${ controllers . length } controllers:` , controllers ) ;
187+ if ( this . _mode == AppMode . DEV && logger ) {
188+ logger . debug ( `Found ${ controllers . length } controllers: ${ controllers . map ( c => c . constructor . name ) . join ( ", " ) } ` ) ;
186189 }
187190 this . registerRouter ( router , controllers ) ;
188191
@@ -229,7 +232,7 @@ export class Knight {
229232 }
230233
231234 public static async start ( port : number = 8080 , logger ?: Logger ) : Promise < void > {
232- const app = await this . build ( ) ;
235+ const app = await this . build ( logger ) ;
233236 if ( this . _mode === AppMode . DEV ) {
234237 app . use ( async ( ctx , next ) => {
235238 console . log ( `${ ctx . request . method } ${ ctx . request . url } ` ) ;
0 commit comments