Improved client bot logging

This commit is contained in:
Logan Cusano
2023-05-27 21:17:31 -04:00
parent 3719fce86a
commit a9d3c33af2

View File

@@ -1,6 +1,7 @@
// Debug
const { DebugBuilder } = require("../utilities/debugBuilder.js");
const log = new DebugBuilder("client", "clientController");
const botLog = new DebugBuilder("client", "clientController:bot");
const spawn = require('child_process').spawn;
const { resolve } = require("path");
@@ -30,7 +31,7 @@ exports.joinServer = async (req, res) => {
const NGThreshold = req.body.NGThreshold ?? 50
// Joining the discord server
log.INFO("Join requested to: ", deviceId, channelId, clientId);
log.INFO("Join requested to: ", deviceId, channelId, clientId, presetName, NGThreshold);
if (process.platform === "win32") {
log.DEBUG("Starting Windows Python");
pythonProcess = await spawn('H:\\Logan\\Projects\\Python-Discord-Audio-Bot\\venv\\Scripts\\python.exe', [resolve(__dirname, "../pdab/main.py"), deviceId, channelId, clientId, '-n', NGThreshold], { cwd: resolve(__dirname, "../pdab/").toString() });
@@ -46,12 +47,12 @@ exports.joinServer = async (req, res) => {
let fullOutput;
pythonProcess.stdout.setEncoding('utf8');
pythonProcess.stdout.on("data", (data) => {
log.VERBOSE("From Process: ", data);
botLog.VERBOSE("From Process: ", data);
fullOutput += data.toString();
});
pythonProcess.stderr.on('data', (data) => {
log.VERBOSE(`stderr: ${data}`);
botLog.VERBOSE(`stderr: ${data}`);
fullOutput += data.toString();
});