В конфиг добавлен параметр logQueries для журналирования запросов и времени их выполнения

This commit is contained in:
Book Pauk
2024-03-25 14:42:52 +07:00
parent 5aefa9e558
commit bbf7b43aa3
6 changed files with 42 additions and 4 deletions

View File

@@ -196,6 +196,20 @@ function wordEnding(num, type = 0) {
}
}
function cutString(data, len = 500) {
try {
if (!data)
return '';
if (typeof(data) !== 'string')
data = JSON.stringify(data);
return `${data.substring(0, len)}${data.length > len ? ' ...' : ''}`;
} catch (e) {
return '';
}
}
module.exports = {
sleep,
processLoop,
@@ -216,4 +230,5 @@ module.exports = {
makeValidFileName,
makeValidFileNameOrEmpty,
wordEnding,
cutString,
};