javascript - flv.js 實(shí)時(shí)監(jiān)控輸出日志是如何實(shí)現(xiàn)的
問題描述
看了flv.js 未壓縮的版本,找不到調(diào)用Log的地方,是如何實(shí)現(xiàn)實(shí)時(shí)監(jiān)控并輸出日志的呢?
var Log = function () { function Log() {_classCallCheck(this, Log); } _createClass(Log, null, [{key: ’e’,value: function e(tag, msg) { if (!Log.ENABLE_ERROR) {return; } if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG; var str = ’[’ + tag + ’] > ’ + msg; if (console.error) {console.error(str); } else if (console.warn) {console.warn(str); } else {console.log(str); }} }, {key: ’i’,value: function i(tag, msg) { if (!Log.ENABLE_INFO) {return; } if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG; var str = ’[’ + tag + ’] > ’ + msg; if (console.info) {console.info(str); } else {console.log(str); }} }, {key: ’w’,value: function w(tag, msg) { if (!Log.ENABLE_WARN) {return; } if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG; var str = ’[’ + tag + ’] > ’ + msg; if (console.warn) {console.warn(str); } else {console.log(str); }} }, {key: ’d’,value: function d(tag, msg) { if (!Log.ENABLE_DEBUG) {return; } if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG; var str = ’[’ + tag + ’] > ’ + msg; if (console.debug) {console.debug(str); } else {console.log(str); }} }, {key: ’v’,value: function v(tag, msg) { if (!Log.ENABLE_VERBOSE) {return; } if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG; console.log(’[’ + tag + ’] > ’ + msg);} }]); return Log;}();Log.GLOBAL_TAG = ’flv.js’;Log.FORCE_GLOBAL_TAG = false;Log.ENABLE_ERROR = true;Log.ENABLE_INFO = true;Log.ENABLE_WARN = true;Log.ENABLE_DEBUG = true;Log.ENABLE_VERBOSE = true;exports.default = Log;
問題解答
回答1:有感嘆號, 黃色背景的是 console.warn
console.warn
https://github.com/Bilibili/f...
相關(guān)文章:
1. python的文件讀寫問題?2. javascript - h5上的手機(jī)號默認(rèn)沒有識別3. mysql里的大表用mycat做水平拆分,是不是要先手動分好,再配置mycat4. javascript - 圖片鏈接請求一直是pending狀態(tài),導(dǎo)致頁面崩潰,怎么解決?5. 怎么用css截取字符?6. python - 獲取到的數(shù)據(jù)生成新的mysql表7. javascript - 關(guān)于圣杯布局的一點(diǎn)疑惑8. window下mysql中文亂碼怎么解決??9. javascript - jquery hide()方法無效10. css - 關(guān)于input標(biāo)簽disabled問題
