-
you can git clone https://github.com/XavierJava/log.git this libray in your project,
in this log you can get which file and line and log time
-
const { dump, error, info, warn, celebr } = require('log/index.js');
-
log number
/**
* log number
*/
info("log number");
dump(123);
error(123);
info(123);
warn(123);
celebr(123);
- log string
/**
* log string
*/
info("log string");
dump("abc");
error("def");
info("abc");
warn("123123");
celebr("098765");
- log array
/**
* log array
*/
info("log array");
dump(["abc"]);
error(["def"]);
info(["abc"]);
warn(["123123"]);
celebr(["098765"]);
- log json
/**
* log json
*/
info("log json");
void function() {
dump(["abc"],{
"a":"1312312312312312312123123"
});
error(["abc"],{
"a":"1312312312312312312123123",
"b":"1312312312312312312123123123123123123123123"
});
info(["abc"],{
"a":"1312312312312312312123123"
});
warn(["abc"],{
"a":"1312312312312312312123123"
});
celebr(["abc"],{
"a":"1312312312312312312123123"
});
}();
- log error
/**
* log error
*/
info("log error");
void function() {
error(new Error(),new Error());
}();