Skip to content

Commit

Permalink
Merge branch 'master' of github.com:iv-web/wardjs-report
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo555 committed Mar 7, 2019
2 parents 1c5c59c + 43eb9c3 commit 907c8ab
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const wardjs = new WardjsReport({
| ignore | [] | 忽略某个错误, 支持 Regexp 和 Function |
| random | 1 | 抽样 (0-1] 1-全量 |
| delay | 1000 | 延迟上报时间 |
| maxLength | 500 | 每条日志默认长度(不建议修改) |
| submit | null | 自定义上报方式 |
| repeat | 5 | 重复上报次数(对于同一个错误超过多少次不上报) |
| offlineLog | false | 是否开启离线日志 |
Expand Down
1 change: 1 addition & 0 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
offlineLog: true,
offlineLogAuto: true,
delay: 3000,
maxLength: 10000,
onReport: function (bid, reportLog) {
console.log(bid, reportLog);
},
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const _config = {
ignore: [], // 忽略某个错误, 支持 Regexp 和 Function
random: 1, // 抽样 (0-1] 1-全量
delay: 1000, // 延迟上报
maxLength: 500, // 每条日志内容最大长度,通常不建议修改
submit: null, // 自定义上报方式
monitorUrl: '//report.url.cn/report/report_vm', // 自定义统计上报地址
repeat: 5, // 重复上报次数(对于同一个错误超过多少次不上报),
Expand Down
2 changes: 1 addition & 1 deletion src/log/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class Log {
}

// 有效保证字符不要过长
reportLog.msg = (reportLog.msg + '' || '').substr(0, 500)
reportLog.msg = (reportLog.msg + '' || '').substr(0, config.maxLength)
// 重复上报
if (isRepeat(reportLog, config.repeat)) continue
const logStr = reportLog2String(reportLog, submitLogList.length, config)
Expand Down

0 comments on commit 907c8ab

Please sign in to comment.