Skip to content

Commit

Permalink
chore(logger): logger add limit
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyoukun committed Jul 11, 2018
1 parent b22f8e0 commit caf1e62
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bin/tsw/util/auto-report/logReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,30 @@ module.exports.receiveCloud = function(req, res) {
return returnJson('get appkey error');
}

if (data.logText) {
return returnJson('logText is invalid');
}

if (typeof data.logText !== 'string') {
return returnJson('logText is not string');
}

if (data.logText.length >= 64 * 1024) {
return returnJson('logText is large than 64KB');
}

if (!data.logJson) {
return returnJson('logJson is invalid');
}

if (typeof data.logJson !== 'string') {
return returnJson('logJson is not string');
}

if (data.logText.length >= 1024 * 1024) {
return returnJson('logJson is large than 1MB');
}

const appid = context.appid;
const appkey = context.appkey;
const reportKey = [appid, data.key].join('/');
Expand Down

0 comments on commit caf1e62

Please sign in to comment.