mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-22 17:39:19 +00:00
add trace support (#38)
* add basic support for sending console logs to OutputWindow * add trace config setting * standardise logs
This commit is contained in:
11
src/util.js
11
src/util.js
@@ -1,13 +1,18 @@
|
||||
const crypto = require('crypto');
|
||||
|
||||
var nofn = function () { };
|
||||
var D = exports.D = console.log.bind(console);
|
||||
var E = exports.E = console.error.bind(console);
|
||||
var W = exports.W = console.warn.bind(console);
|
||||
const messagePrintCallbacks = new Set();
|
||||
var D = exports.D = (...args) => (console.log(...args), messagePrintCallbacks.forEach(cb => cb(...args)))
|
||||
var E = exports.E = (...args) => (console.error(...args), messagePrintCallbacks.forEach(cb => cb(...args)))
|
||||
var W = exports.W = (...args) => (console.warn(...args), messagePrintCallbacks.forEach(cb => cb(...args)))
|
||||
var DD = nofn, cl = D, printf = D;
|
||||
var print_jdwp_data = nofn;// _print_jdwp_data;
|
||||
var print_packet = nofn;//_print_packet;
|
||||
|
||||
exports.onMessagePrint = function(cb) {
|
||||
messagePrintCallbacks.add(cb);
|
||||
}
|
||||
|
||||
Array.first = function (arr, fn, defaultvalue) {
|
||||
var idx = Array.indexOfFirst(arr, fn);
|
||||
return idx < 0 ? defaultvalue : arr[idx];
|
||||
|
||||
Reference in New Issue
Block a user