javascript - flv.js 實時監控輸出日志是如何實現的
問題描述
看了flv.js 未壓縮的版本,找不到調用Log的地方,是如何實現實時監控并輸出日志的呢?
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...
相關文章:
1. 自己安裝了apache2.2,但是重啟apache后出錯了,求解!謝謝!2. 關于docker下的nginx壓力測試3. angular.js - angularjs的自定義過濾器如何給文字加顏色?4. docker-machine添加一個已有的docker主機問題5. angular.js使用$resource服務把數據存入mongodb的問題。6. docker - 如何修改運行中容器的配置7. docker安裝后出現Cannot connect to the Docker daemon.8. 為什么我ping不通我的docker容器呢???9. nignx - docker內nginx 80端口被占用10. Docker for Mac 創建的dnsmasq容器連不上/不工作的問題
