Prints messages related to the execution of the decorated method to the console.
Note that this functionality can be enabled and disabled by configuring
the tracing
option when configuring this module for your application.
When @Trace() is used outside of an Alterior execution context, the trace
logs are always enabled, and the default log listeners are used.
For example, given a class:
class Thing {
@ConsoleTrace()
static doSomething(data : any, stuff : number) {
console.log("ALMOST...");
try {
this.anotherSomething(stuff);
} catch (e) {
}
}
@ConsoleTrace()
static anotherSomething(stuff : number) {
console.log("NAH...");
throw new Error('Uh oh');
}
}
When executed, one may see:
Thing#doSomething({"stuff":321,"other":"nice"}, 12333) {
ALMOST...
Thing#anotherSomething(12333) {
NAH...
(!!) Exception:
Error: Uh oh
} // [Exception] Thing#anotherSomething(12333)
} // [Done, 6ms] Thing#doSomething({"stuff":321,"other":"nice"}, 12333)
Echos the value of a value. Trys to print the value out in the best way possible given the different types.
The object to print out.
Optional options object that alters the output.
Pass the string through with no stylization.
Use console colors to style the string. Suitable for output to terminals with ANSI color support.
Generated using TypeDoc
If an exception occurs within the target method, report that exception to the console and rethrow.