trace()
Version 2.x
trace(name, level)
prints a trace log using console.log()
. It is used mainly for debugging. Included details:
- instance
- parameters
- result values (both normally returned and thrown exceptions)
All objects are printed using indirect calls to their respective toString()
methods.
It is defined in dcl/advices/trace.js
.
Description
The result value of trace
module is a function, which takes two parameters. The first parameter name
is a string that is used to indicate a method call. Usually it is a method name. The second optional parameter level
is a Boolean value. If it is true, a level number is printed and indentation is used to indicate how method calls are embedded. Otherwise (the default), the level information is not printed.
It returns an advice object, which can be used directly with dcl.advise() or advise().
Examples
Class-level example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
The example above will print:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Object-level example:
1 2 3 4 5 6 7 8 |
|
The example above will print:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|