The main method of this module logs on console debugging details about an object. Provided details includes an ordered list of dependencies, super calls, and both class-level and object-level AOP advises.
Working with non-trivial inheritance chains can be puzzling. While the C3 MRO algorithm used by
dcl takes care of duplicates and ordering of mixins, in some cases programmer needs to know the exact details of such linearization.
dcl.log() prints what weaver was used for a given property, it uses names of weavers explained in dcl.chainWith(). Specifically, if a property has a weaver named:
- “before” – it was chained with dcl.chainBefore(), which uses dcl.weaverBefore.
- “after” – it was chained with dcl.chainAfter(), which uses dcl.weaverAfter.
- “super” – somewhere in its chain, an AOP advise (or a supercall) was used, which requires using dcl.weaverSuper.
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
The snippet above will produce a following output on console:
1 2 3 4
It is always a good idea to specify a property called
declaredClass, which can be any readable text used to identify your “class” definition. It is used by
dcl/debug facilities to provide a human-readable information. Common convention is to specify a name to reflect its logical “path”, like