Commit ab951129 authored by jiangjiantao's avatar jiangjiantao

后屏增加错误监控

parent ce70185f
App({
import monitor from '/utils/alipayLogger';
App(monitor.hookApp({
globalData: {
version: "1.0.1.20200311",
......@@ -9,12 +11,36 @@ App({
},
onLaunch(options) {
monitor.init({
pid: "qzhr85jigetfamuqniwz4q==",
options: options,
sample: 1,
autoReportApi: true,
autoReportPage: true,
// Http请求返回数据中状态码字段名称
code: ["success"],
// Http返回数据中的error message字段名称
msg: ["errorMsg"]
});
// 第一次打开
// options.query == {number:1}
console.info('App onLaunch');
},
onShow(options) {
// 从后台被 scheme 重新打开
// options.query == {number:1}
},
});
// onError(err)
// {
// // debugger;
// console.log("草泥马");
// // fundebug.onError(err);
// },
}));
......@@ -161,9 +161,9 @@ Page({
onLoad(query) {
console.info(a);
// 页面加载
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
onReady() {
// 页面加载完成
......
This diff is collapsed.
var _0x11f3=["name","Module","exports","appVersion","silent","captureBreadcrumb","length","locationInfo","error","isFiltered","headers","request","httpRequest","constructor","fundebug.notify()的option参数类型必须为object!"];(function(t,e){var r=function(e){while(--e){t["push"](t["shift"]())}};r(++e)})(_0x11f3,211);var _0x1c24=function(e,t){e=e-0;var r=_0x11f3[e];return r};module["exports"]=function(r){var n={};function o(e){if(n[e])return n[e]["exports"];var t=n[e]={i:e,l:!1,exports:{}};return r[e]["call"](t["exports"],t,t["exports"],o),t["l"]=!0,t["exports"]}return o["m"]=r,o["c"]=n,o["d"]=function(e,t,r){o["o"](e,t)||Object["defineProperty"](e,t,{enumerable:!0,get:r})},o["r"]=function(e){"undefined"!=typeof Symbol&&Symbol["toStringTag"]&&Object["defineProperty"](e,Symbol["toStringTag"],{value:_0x1c24("0x0")}),Object["defineProperty"](e,"__esModule",{value:!0})},o["t"]=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t["__esModule"])return t;var r=Object["create"](null);if(o["r"](r),Object["defineProperty"](r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o["d"](r,n,function(e){return t[e]}["bind"](null,n));return r},o["n"]=function(e){var t=e&&e["__esModule"]?function(){return e["default"]}:function(){return e};return o["d"](t,"a",t),t},o["o"]=function(e,t){return Object["prototype"]["hasOwnProperty"]["call"](e,t)},o["p"]="",o(o["s"]=0)}([function(e,t,r){"use strict";var n=r(1),o=r(5),i=r(8),u=r(9),c=r(10),f={},s=[],a={};f["init"]=n(a,s),f["onError"]=o(a,s,f),f["test"]=u(a,s,f),f["notify"]=i(a,s,f),f["notifyError"]=c(a,s,f),e[_0x1c24("0x1")]=f},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol["iterator"]?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e["constructor"]===Symbol&&e!==Symbol["prototype"]?"symbol":typeof e},o=r(2),i=r(4);e[_0x1c24("0x1")]=function(r,e){return function(t){if(t&&"object"===(void 0===t?"undefined":n(t))){["apikey",_0x1c24("0x2"),"releaseStage","metaData","filters",_0x1c24("0x3"),"silentPage"]["forEach"](function(e){r[e]=t[e]}),o(e),i["getNetworkType"](),t["setSystemInfo"]&&i["getSystemInfo"](),t["setLocation"]&&i["getLocation"]()}}}},function(e,t,r){"use strict";var o=r(3);e[_0x1c24("0x1")]=function(n){["log","error","info","warn"]["forEach"](function(e){var t,r;t=e,r=console[t],console[t]=function(){try{var e={};e["type"]="console";e["time"]=(new Date).getTime();e["method"]=t;e["args"]=arguments;o[_0x1c24("0x4")](n,e)}catch(e){console["error"](e)}r&&r["apply"](this,arguments)}})}},function(e,t,r){"use strict";t["captureBreadcrumb"]=function(e,t){e["push"](t),20<e["length"]&&e["shift"]()},t["getCurrentPage"]=function(){var e=getCurrentPages();if(e[_0x1c24("0x5")]){var t=e[e["length"]-1];if(t)return t["route"]=t["route"],t}}},function(e,t,r){"use strict";var o=r(3),i=void 0,u=void 0,c=void 0;t["getEvent"]=function(e,t,r){var n={};n["notifierVersion"]="0.2.0";n["systemInfo"]=i;n[_0x1c24("0x6")]=u;n["networkType"]=c;return n["scene"]=e["scene"],n["apikey"]=e["apikey"],n["appVersion"]=e["appVersion"],n["releaseStage"]=e["releaseStage"],n["metaData"]=r["metaData"]||e["metaData"],n["breadcrumbs"]=t,n["time"]=(new Date)["getTime"](),e["silentPage"]||(n["Page"]=o["getCurrentPage"]()),n},t["getNetworkType"]=function(){my["getNetworkType"]({success:function(e){c=e["networkType"]}})},t["getSystemInfo"]=function(){my["getSystemInfo"]({success:function(e){i=e}})},t["getLocation"]=function(){my["getLocation"]({type:1,success:function(e){u=e}})}},function(e,t,r){"use strict";var o=r(6);e["exports"]=function(t,r,n){return function(e){try{if(t["silent"])return;if(!e)return void console["error"]("fundebug.onError()必须指定error参数!");if("string"!=typeof e)return void console["error"]("fundebug.onError()的error参数类型必须为string!");o({type:"uncaught",error:e},t,r,n)}catch(e){console[_0x1c24("0x7")](e)}}}},function(e,t,r){"use strict";var u=r(7),c=r(4),f=5;e[_0x1c24("0x1")]=function(e,t,r,n){var o=c["getEvent"](t,r,n);if(e=Object["assign"](o,e),JSON["stringify"](e,null,4),!u[_0x1c24("0x8")](e,t["filters"])&&function(e){if(!e["apikey"])return void console["error"]("请使用fundebug.init(https://docs.fundebug.com/notifier/aliapp/api/init.html)配置apikey!");return!!f&&(f--,!0)}(e)){var i={};i["url"]="https://aliapp.fundebug.net/event/";i["method"]="POST";i[_0x1c24("0x9")]={};i["data"]=JSON.stringify(e);i[_0x1c24("0x9")]["Content-Type"]="application/json";my["canIUse"]("request")?my[_0x1c24("0xa")](i):my[_0x1c24("0xb")](i)}}},function(e,t,r){"use strict";function n(e,t){if(!e)return!1;if(!t)return!1;if(Object["keys"]&&!Object["keys"](t)["length"])return!1;for(var r in t)if(t["hasOwnProperty"](r))if(t[r]["constructor"]===RegExp){if(!t[r]["test"](e[r]))return!1}else if(t[r]["constructor"]===Object){if(!n(e[r],t[r]))return!1}else{if(t[r]["constructor"]!==String||"inexistence"!==t[r])return!1;if(e["hasOwnProperty"](r))return!1}return!0}t["isFiltered"]=function(e,t){if(!t||!t["length"])return!1;for(var r=0;r<t["length"];r++)if(n(e,t[r]))return!0;return!1}},function(e,t,r){"use strict";var c="function"==typeof Symbol&&"symbol"==typeof Symbol["iterator"]?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e[_0x1c24("0xc")]===Symbol&&e!==Symbol["prototype"]?"symbol":typeof e},f=r(6);e["exports"]=function(o,i,u){return function(e,t,r){try{if(o["silent"])return;if(!e)return void console[_0x1c24("0x7")]("fundebug.notify()必须指定name参数!");if("string"!=typeof e)return void console["error"]("fundebug.notify()的name参数类型必须为string!");if(t&&"string"!=typeof t)return void console["error"]("fundebug.notify()的message参数类型必须为string!");if(r&&"object"!==(void 0===r?"undefined":c(r)))return void console["error"](_0x1c24("0xd"));var n={};n["type"]="notification";n[_0x1c24("0xe")]=e;n["message"]=t;r&&r["metaData"]&&(n["metaData"]=r["metaData"]),f(n,o,i,u)}catch(e){console["error"](e)}}}},function(e,t,r){"use strict";var i=r(6);e["exports"]=function(r,n,o){return function(e,t){try{if(r["silent"])return;if(e&&"string"!=typeof e)return void console["error"]("fundebug.test()的name参数类型必须为string!");if(t&&"string"!=typeof t)return void console["error"]("fundebug.test()的message参数类型必须为string!");i({type:"test",name:e||"Test",message:t||"Hello, Fundebug!"},r,n,o)}catch(e){console["error"](e)}}}},function(e,t,r){"use strict";var u="function"==typeof Symbol&&"symbol"==typeof Symbol["iterator"]?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e["constructor"]===Symbol&&e!==Symbol["prototype"]?"symbol":typeof e},c=r(6);e["exports"]=function(n,o,i){return function(e,t){try{if(n["silent"])return;if(!e)return void console["error"]("fundebug.notifyError()必须指定error参数!");if(!(e instanceof Error))return void console["error"]("fundebug.notifyError()的error参数类型必须为Error实例!");if(t&&"object"!==(void 0===t?"undefined":u(t)))return void console[_0x1c24("0x7")]("fundebug.notifyError()的option参数类型必须为object!");var r={};r["type"]="caught";r["error"]={};r["error"]["name"]=e.name;r["error"]["message"]=e.message;r["error"]["stack"]=e.stack;t&&(t["name"]&&(r["name"]=t["name"]),t["metaData"]&&(r["metaData"]=t["metaData"])),c(r,n,o,i)}catch(e){console["error"](e)}}}}]);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment