Created
June 6, 2020 09:11
-
-
Save huuyafwww/50cbf18671d66efe7ab5efe321303f76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>StackTrace</title> | |
</head> | |
<body> | |
<script> | |
window.onerror = function(msg, file, line, col, err) { | |
let err_body = ( | |
file + "\n" + "の" + | |
line + "行目" + col + "文字目から" + "\n" + | |
msg + "\n" + "というエラーが発生しました" | |
); | |
let err_array = { | |
"msg" : msg, | |
"file" : file, | |
"line" : line, | |
"col" : col | |
}; | |
alert( | |
err_body | |
); | |
console.log( | |
err_array | |
); | |
}; | |
bar(); | |
</script> | |
</body> | |
</html> |
let now_url = location.href;
として現在のページURLを連想配列に加えるなど
LocalStorage等に操作ログを記録しながら、
タイムスタンプを含めるなど
let now_time = Math.floor(
new Date()
.getTime()
/
1000
);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
クライアントサイドのエラーを
window.onerror
で取得するその他必要な情報を連想配列に追記するなりして、
Ajax等でサーバーサイドに投げて記録するような利用方法がある