aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server.ts5
-rw-r--r--server/helpers/logger.ts4
2 files changed, 4 insertions, 5 deletions
diff --git a/server.ts b/server.ts
index 8f280f6c2..dc7a71d60 100644
--- a/server.ts
+++ b/server.ts
@@ -104,11 +104,11 @@ const trackerServer = new TrackerServer({
104}) 104})
105 105
106trackerServer.on('error', function (err) { 106trackerServer.on('error', function (err) {
107 logger.error(err) 107 logger.error('Error in websocket tracker.', err)
108}) 108})
109 109
110trackerServer.on('warning', function (err) { 110trackerServer.on('warning', function (err) {
111 logger.error(err) 111 logger.error('Warning in websocket tracker.', err)
112}) 112})
113 113
114const server = http.createServer(app) 114const server = http.createServer(app)
@@ -116,7 +116,6 @@ const wss = new WebSocketServer({ server: server, path: '/tracker/socket' })
116wss.on('connection', function (ws) { 116wss.on('connection', function (ws) {
117 trackerServer.onWebSocketConnection(ws) 117 trackerServer.onWebSocketConnection(ws)
118}) 118})
119wss.on('error', err => logger.error('Error in websocket server.', err))
120 119
121const onHttpRequest = trackerServer.onHttpRequest.bind(trackerServer) 120const onHttpRequest = trackerServer.onHttpRequest.bind(trackerServer)
122app.get('/tracker/announce', (req, res) => onHttpRequest(req, res, { action: 'announce' })) 121app.get('/tracker/announce', (req, res) => onHttpRequest(req, res, { action: 'announce' }))
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts
index 7624b3cff..201ea2235 100644
--- a/server/helpers/logger.ts
+++ b/server/helpers/logger.ts
@@ -26,12 +26,12 @@ const loggerFormat = winston.format.printf((info) => {
26 if (additionalInfos === '{}') additionalInfos = '' 26 if (additionalInfos === '{}') additionalInfos = ''
27 else additionalInfos = ' ' + additionalInfos 27 else additionalInfos = ' ' + additionalInfos
28 28
29 if (info.message.stack !== undefined) info.message = info.message.stack 29 if (info.message && info.message.stack !== undefined) info.message = info.message.stack
30 return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}` 30 return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}`
31}) 31})
32 32
33const timestampFormatter = winston.format.timestamp({ 33const timestampFormatter = winston.format.timestamp({
34 format: 'YYYY-MM-DD hh:mm:ss.SSS' 34 format: 'YYYY-MM-dd HH:mm:ss.SSS'
35}) 35})
36const labelFormatter = winston.format.label({ 36const labelFormatter = winston.format.label({
37 label 37 label