mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 04:09:26 +00:00
improvement: moved all console logs to pino
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user