XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

improve: logging during startup sequence (#244)

c911fd77
Sainan <sainan@calamity.gg>
提交于

代码差异

2 个文件 +8 -5
Modified src/index.ts +6 -3
@@ -1,8 +1,11 @@
1 import { logger } from "./utils/logger";
2
3 logger.info("Starting up...");
4
1 5 import http from "http";
2 6 import https from "https";
3 7 import fs from "node:fs";
4 8 import { app } from "./app";
5 import { logger } from "./utils/logger";
6 9 import { config } from "./services/configService";
7 10 //const morgan = require("morgan");
8 11 //const bodyParser = require("body-parser");
@@ -17,10 +20,10 @@ const httpPort = config.httpPort || 80;
17 20 const httpsPort = config.httpsPort || 443;
18 21
19 22 // const server = http.createServer(app).listen(80);
20 http.createServer(app).listen(httpPort, () => logger.info("cache server started on port " + httpPort));
23 http.createServer(app).listen(httpPort, () => logger.info("HTTP server started on port " + httpPort));
21 24 const server = https
22 25 .createServer(options, app)
23 .listen(httpsPort, () => logger.info("game server started on port " + httpsPort));
26 .listen(httpsPort, () => logger.info("HTTPS server started on port " + httpsPort));
24 27
25 28 // server.keepAliveTimeout = 60 * 1000 + 1000;
26 29 // server.headersTimeout = 60 * 1000 + 2000;
Modified src/services/mongoService.ts +2 -2
@@ -11,10 +11,10 @@ if (url === undefined) {
11 11 const connectDatabase = async () => {
12 12 try {
13 13 await mongoose.connect(`${url}`);
14 logger.info("connected to MongoDB");
14 logger.info("Connected to MongoDB");
15 15 } catch (error: unknown) {
16 16 if (error instanceof Error) {
17 logger.error(`error connecting to MongoDB ${error.message}`);
17 logger.error(`Error connecting to MongoDB ${error.message}`);
18 18 }
19 19 }
20 20 };