#140 : Individual log files

This commit is contained in:
2024-09-21 15:39:50 +02:00
parent 90ac7728d9
commit 798bfac643
24 changed files with 136 additions and 135 deletions

View File

@ -3,7 +3,7 @@ import { TSocket } from '../utilities/types'
import config from '../utilities/config'
import UserRepository from '../repositories/userRepository'
import { User } from '@prisma/client'
import logger from '../utilities/logger'
import { gameLogger } from '../utilities/logger'
/**
* Socket io jwt auth middleware
@ -12,7 +12,7 @@ import logger from '../utilities/logger'
*/
export async function Authentication(socket: TSocket, next: any) {
if (!socket.request.headers.cookie) {
logger.warn('No cookie provided')
gameLogger.warn('No cookie provided')
return next(new Error('Authentication error'))
}
@ -33,7 +33,7 @@ export async function Authentication(socket: TSocket, next: any) {
if (token) {
verify(token, config.JWT_SECRET, async (err: any, decoded: any) => {
if (err) {
logger.error('Invalid token')
gameLogger.error('Invalid token')
return next(new Error('Authentication error'))
}
@ -41,7 +41,7 @@ export async function Authentication(socket: TSocket, next: any) {
next()
})
} else {
logger.warn('No token provided')
gameLogger.warn('No token provided')
return next(new Error('Authentication error'))
}
}