Nicest way to emulate function decorators?

I think it was the :trace module could allow you to hook functions, so you could define things to instrument based on module name and function name from the config or so?