From c72b2c494e53f6261f8301650bbc0058f8201d89 Mon Sep 17 00:00:00 2001 From: sophie Date: Fri, 3 May 2024 20:29:22 +0300 Subject: [PATCH] debug --- classes/Server.ts | 3 ++- deps.ts | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/classes/Server.ts b/classes/Server.ts index 6413de0..af76754 100644 --- a/classes/Server.ts +++ b/classes/Server.ts @@ -46,7 +46,8 @@ export class Server { } else { socket.data.dataBuffer = data; } - + log.debug("Socket", socket.remoteAddress, "has", socket.data.dataBuffer.length, "data for parsing."); + const parseBuffer = () => { if(!socket.data.dataBuffer) return; diff --git a/deps.ts b/deps.ts index 5318256..0c6aad2 100644 --- a/deps.ts +++ b/deps.ts @@ -9,6 +9,11 @@ export const log = { }, critical: (...a) => { console.error("[ERROR]", ...a); + }, + debug: (...a) => { + if(config.debug) { + console.log("[DEBUG]", ...a) + } } } export const config = { @@ -19,5 +24,6 @@ export const config = { main: process.env.MAIN || "main", maxUsers: +(process.env.USERS || 24) > 255 ? 255 : +(process.env.USERS || 24), software: process.env.SOFTWARE || "Custom Cla66ic", - name: process.env.NAME || "Cla66ic Server" + name: process.env.NAME || "Cla66ic Server", + debug: process.env.DEBUG == "true", };