improvement: moved all console logs to pino

This commit is contained in:
canove
2021-01-07 20:52:51 -03:00
parent 0689b55453
commit 896f122cf7
16 changed files with 57 additions and 36 deletions

View File

@@ -1,6 +1,7 @@
import socketIo, { Server as SocketIO } from "socket.io";
import { Server } from "http";
import AppError from "../errors/AppError";
import { logger } from "../utils/logger";
let io: SocketIO;
@@ -8,24 +9,24 @@ export const initIO = (httpServer: Server): SocketIO => {
io = socketIo(httpServer);
io.on("connection", socket => {
console.log("Client Connected");
logger.info("Client Connected");
socket.on("joinChatBox", ticketId => {
console.log("A client joined a ticket channel");
logger.info("A client joined a ticket channel");
socket.join(ticketId);
});
socket.on("joinNotification", () => {
console.log("A client joined notification channel");
logger.info("A client joined notification channel");
socket.join("notification");
});
socket.on("joinTickets", status => {
console.log(`A client joined to ${status} tickets channel.`);
logger.info(`A client joined to ${status} tickets channel.`);
socket.join(status);
});
socket.on("disconnect", () => {
console.log("Client disconnected");
logger.info("Client disconnected");
});
});
return io;