mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
Better logging for command execution time
This commit is contained in:
1 parent
9f5dd47954
commit
217e2f1c2a
1 file changed
+5
-2
@@ -101,14 +101,17 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const inputTime = new Date();
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
await command.run({ interaction, client });
|
await command.run({ interaction, client });
|
||||||
|
const outputTime = new Date();
|
||||||
|
const executionTime = outputTime - inputTime;
|
||||||
console.log(
|
console.log(
|
||||||
`${new Date().toISOString().substring(11, 19)}: ${
|
`${new Date().toISOString().substring(11, 19)}: ${
|
||||||
interaction.guild.name
|
interaction.guild.name
|
||||||
} (#${interaction.guild.memberCount})> Command '/${
|
} (#${interaction.guild.memberCount})> Ran command '/${
|
||||||
interaction.commandName
|
interaction.commandName
|
||||||
}' was executed successfully.`
|
}' successfully in ${executionTime} ms.`
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// log error to console with full object depth
|
// log error to console with full object depth
|
||||||
|
|||||||
Reference in new issue
Block a user