1.1.1 • Published 8 years ago
ts-debugger v1.1.1
Usage
$ npm install ts-debugger --save-dev
Logger information:
// example.ts
import {Logger, Level} from "ts-debugger";
declare let log: Logger;
// show string, array, object
let test = {a: 1, b: 2, c: 3};
log.debug("This is object: ", test);
/*
[DEBUG] [
"This is object: ",
{
"a": 1,
"b": 2,
"c": 3
}
]
*/
log.debug("This is object: ")(test);
/* [DEBUG] This is object: Object {a: 1, b: 2, c: 3} */
Warning, Error
Example
// polyfills.ts
import {Logger, Level} from "ts-debugger";
import "core-js/client/shim";
import "reflect-metadata";
import "ts-helpers";
require("zone.js/dist/zone");
declare let log: Logger;
declare let window: any;
if (process.env.TYPE === "prod") {
// Production
window.log = new Logger(Level.INFO);
} else {
// Development
window.log = new Logger();
Error["stackTraceLimit"] = Infinity;
require("zone.js/dist/long-stack-trace-zone");
}
log.debug(
`Level debug: ${log["levelMin"]}`,
`TYPE = ${process.env.TYPE}`,
`THEME = ${process.env.THEME}`
)();