Skip to content

Commit 12b55ec

Browse files
committed
Use winstonLogger to log server start
1 parent f7b8e0d commit 12b55ec

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/apps/mooc_backend/config/dependency-injection/application.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ services:
77
class: ../../../../Mooc/Courses/application/CreateCourse
88
arguments: ["@Mooc.courses.CourseRepository"]
99

10+
Mooc.shared.WinstonLogger:
11+
class: ../../../../Mooc/Shared/infrastructure/WinstonLogger
12+
arguments: []
13+
1014
Apps.mooc.controllers.CreateCourseController:
1115
class: ../../controllers/CreateCourseController
1216
arguments: ["@Mooc.courses.CreateCourse"]

src/apps/mooc_backend/server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import errorHandler from 'errorhandler';
22
import app from './app';
3+
import container from './config/dependency-injection';
34

45
/**
56
* Error Handler. Provides full stack - remove for production
@@ -11,7 +12,9 @@ app.use(errorHandler());
1112
*/
1213
const server = app.listen(app.get('port'), () => {
1314
// tslint:disable: no-console
14-
console.log(' App is running at http://localhost:%d in %s mode', app.get('port'), app.get('env'));
15+
const winstonLogger = container.get('Mooc.shared.WinstonLogger');
16+
17+
winstonLogger.info(` App is running at http://localhost:${app.get('port')} in ${app.get('env')} mode`);
1518
console.log(' Press CTRL-C to stop\n');
1619
});
1720

0 commit comments

Comments
 (0)