mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-25 22:55:49 +00:00
Log: New logging system.
Right now, all I've done is move the logging function from utils to its own file. I've also refactored it and created some classes. Next step would be to somehow get rid of the trace setting. The Remote class should have nothing to do with logging settings. Perhaps we can keep the setting for backwards compatibility only, but the main way to turn logging on/off or filter logging messages should be through the Log class.
This commit is contained in:
@@ -92,18 +92,6 @@ function chunkString(str, n, leftAlign) {
|
||||
return ret;
|
||||
};
|
||||
|
||||
function logObject(msg) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
args = args.map(function(arg) {
|
||||
return JSON.stringify(arg, null, 2);
|
||||
});
|
||||
|
||||
args.unshift(msg);
|
||||
|
||||
console.log.apply(console, args);
|
||||
};
|
||||
|
||||
function assert(assertion, msg) {
|
||||
if (!assertion) {
|
||||
throw new Error("Assertion failed" + (msg ? ": "+msg : "."));
|
||||
@@ -157,7 +145,6 @@ exports.hexToArray = hexToArray;
|
||||
exports.stringToArray = stringToArray;
|
||||
exports.stringToHex = stringToHex;
|
||||
exports.chunkString = chunkString;
|
||||
exports.logObject = logObject;
|
||||
exports.assert = assert;
|
||||
exports.arrayUnique = arrayUnique;
|
||||
exports.toTimestamp = toTimestamp;
|
||||
|
||||
Reference in New Issue
Block a user