feat: Add silent log level for Cloud Code (#8803)

This commit is contained in:
Diamond Lewis
2024-03-21 10:19:29 -05:00
committed by GitHub
parent 7d84b244ab
commit 5f81efb429
5 changed files with 104 additions and 27 deletions

View File

@@ -132,6 +132,16 @@ const defaultConfiguration = {
allowClientClassCreation: true,
};
if (silent) {
defaultConfiguration.logLevels = {
cloudFunctionSuccess: 'silent',
cloudFunctionError: 'silent',
triggerAfter: 'silent',
triggerBeforeError: 'silent',
triggerBeforeSuccess: 'silent',
};
}
if (process.env.PARSE_SERVER_TEST_CACHE === 'redis') {
defaultConfiguration.cacheAdapter = new RedisCacheAdapter();
}
@@ -434,8 +444,8 @@ try {
// Fetch test exclusion list
testExclusionList = require('./testExclusionList.json');
console.log(`Using test exclusion list with ${testExclusionList.length} entries`);
} catch(error) {
if(error.code !== 'MODULE_NOT_FOUND') {
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND') {
throw error;
}
}
@@ -445,10 +455,7 @@ global.it_id = (id, func) => {
if (testExclusionList.includes(id)) {
return xit;
} else {
if(func === undefined)
return it;
else
return func;
return func || it;
}
};