diff --git a/index.js b/index.js index b930189..d220176 100644 --- a/index.js +++ b/index.js @@ -37,10 +37,15 @@ app.get('/metrics', async (req, res) => { try { const client = new SourceRcon.default(config.ip, Number.parseInt(config.port)); + console.log(`[${config.game} ${config.ip}:${config.port}] connecting`); await client.connect(); + console.log(`[${config.game} ${config.ip}:${config.port}] connected`); await client.auth(config.rconPassword); + console.log(`[${config.game} ${config.ip}:${config.port}] auth`); const response = await module.request(config, client); + console.log(`[${config.game} ${config.ip}:${config.port}] request`); await module.send(config, response, res); + console.log(`[${config.game} ${config.ip}:${config.port}] send`); } catch (e) { if (e.code === 'EHOSTUNREACH') { console.error(`Unreachable host : ${e.address}:${e.port}`); diff --git a/utils/utils.js b/utils/utils.js index ad93047..1a1c779 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -21,8 +21,13 @@ export default { }, async rconCommand(client, command) { try { - return client.send(command); + console.log(`[${client.host}:${client.port}] rcon command :`, command); + const res = await client.send(command); + console.log(`[${client.host}:${client.port}] rcon commands result: ${command}`); + console.log(res); + return res; } catch (err) { + throw err; } return null;