Logging entry/exit into methods &/|| functions
Logging entry/exit into methods &/|| functions
- Subject: Logging entry/exit into methods &/|| functions
- From: Wade Tregaskis <email@hidden>
- Date: Fri, 29 Aug 2003 14:50:40 +1000
I've found it to be immensely helpful to log the entry and exit into
methods in one of my classes. It notes parameters and return values,
and provides a simple mechanism to log messages related the current
method.
To do all this I have written a little class which formats the output
in a hierarchal & thread-safe fashion. This works well enough, but it
fills my methods with the lots of crud - I have about 50 methods in one
particular class, which means about 400 extra lines of junk (if you
count the #ifndef NDEBUG's). Is there any better way of getting this
functionality? Keep in mind that my current system is simple and
requires no installation or configuration, which is how I'd like to
keep it.
If there are no suitable existing systems, I was thinking about
rewriting this as a transparent NSObject subclass, to inherit from in
whichever classes I want to 'trace' in this fashion. I briefly thought
about posing as NSObject, but I'm sure even in the most trivial
examples that would be hugely impractical, due to the massive numbers
of messages being sent within Foundation, AppKit, etc. My concern is
that it might be difficult to accurately display the parameters and
returns values without having any specific knowledge of each method. I
only output actual values if they're small, otherwise I just refer to
the object's memory address. I haven't looked in depth, but it seems a
little tricky to efficiently determine a parameter/return's type...
Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.