mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 22:20:56 +00:00
feat(config): add command to modify mysql_debug
Allow toggling debug prints for specific resources during runtime.
This commit is contained in:
1 parent
c92d1f3219
commit
7796c80f69
1 file changed
+26
@@ -26,3 +26,29 @@ export const mysql_transaction_isolation_level = (() => {
|
|||||||
return `${query} READ COMMITTED`;
|
return `${query} READ COMMITTED`;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
RegisterCommand(
|
||||||
|
'oxmysql_debug',
|
||||||
|
(source: number, args: string[]) => {
|
||||||
|
if (source !== 0) return console.log('^3This command can only be run server side^0');
|
||||||
|
switch (args[0]) {
|
||||||
|
case 'add':
|
||||||
|
if (!Array.isArray(mysql_debug)) mysql_debug = [];
|
||||||
|
mysql_debug.push(args[1]);
|
||||||
|
return console.log(`^3Added ${args[1]} to mysql_debug^0`);
|
||||||
|
|
||||||
|
case 'remove':
|
||||||
|
if (Array.isArray(mysql_debug)) {
|
||||||
|
const index = mysql_debug.indexOf(args[1]);
|
||||||
|
if (index === -1) return;
|
||||||
|
mysql_debug.splice(index, 1);
|
||||||
|
if (mysql_debug.length === 0) mysql_debug = false;
|
||||||
|
return console.log(`^3Removed ${args[1]} from mysql_debug^0`);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return console.log(`^3Usage: oxmysql add|remove <resource>^0`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
Reference in new issue
Block a user