Skip to content

Commit 0dc88c3

Browse files
Merge pull request #9 from WilliamRagstad/develop
2 parents 7ffb519 + 0c8fecb commit 0dc88c3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@knight/knight",
3-
"version": "2.4.0",
3+
"version": "2.4.1",
44
"license": "MIT",
55
"exports": "./mod.ts",
66
"imports": {

src/Knight.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)