log every method?

Viewed 578

Instead of having to create a custom logger for TRACE, e.g. following what methods were called and what classes were instantiated, is there an easy way to make all methods under a class log themselves? This is for a node.js application.

class MyClass

  constructor: () ->
    console.log 'MyClass:constructor'

  doThat: () ->
    console.log 'MyClass:doThat'

exports.MyClass = MyClass

myClass = new MyClass()
myClass.doThat()

If I had my way, you'd see 4 log messages instead of 2 (thus having to write less code to trace what's happening).

2 Answers
Related