Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > debug log infrustructure for a library

Reply
Thread Tools

debug log infrustructure for a library

 
 
Damien Cymbal
Guest
Posts: n/a
 
      07-25-2003
Hi,

I am working on a network application library that is structured like this:

There is a series of about 10-15 utility or building-block classes
that consumers can use to get at primitive functionality for creating
their own clients.

On top of this, there is provided a client class that makes use of the
primitive classes and provides a higher level abstraction to a consumer.

What I am currently struggling with is how to perform a consistent and
useful interface for reporting debug messages to the consumer.

Initially I had a system where the consumer had a global hook that it
could set to get the messages. This works well if only one client is
in use, but it doesn't satisfy the desire to provide individual hooks
to multiple clients or threads.

Passing an actual logging reference into each component for logging
just seems way too instrusive.

I suppose this is one of those classic cross-cutting issues in software
development. Can anyone provide any added thoughts on how they have solved
this problem in the past? Any recommendations for other open-source libs
that have done a nice job of handling this that I could look at?

Thanks.
 
Reply With Quote
 
 
 
 
Gianni Mariani
Guest
Posts: n/a
 
      07-25-2003
Damien Cymbal wrote:

> Passing an actual logging reference into each component for logging
> just seems way too instrusive.


This is the way to do it.

In a recent life we created a base class that had pointers to the
configuration and logging systems that were used to set up logging for
all the components in the system.

By providing some tools to do this mostly transparently, it worked like
magic.

Mind you, not all classes inherited from the "Environment" class. It
required design jusdgement which classes needed them and which classes
clould use it's parent. Also, to determine if somthing logged or no was
done in such a way that it could be determined from configuration
"parameters" within the class itself, so you only paid for the cost of
logging when logging was turned on. On top of that you could set a
compile time parameter that would eliminate code altogether for logging
levels you did not want in your final code.

'tis very cool.

Anyway, getting back to you question - yep - intrusive - all objects
that need to log need to know how to get to the "logging and
configuration" environment.







 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
debug="false" in web.config and <%@ debug="true" ...%> in aspx file => true or false? André ASP .Net 3 08-28-2006 12:02 PM
Config Mgr Debug/Release and Web.config Compilation debug=true RonL ASP .Net 0 04-08-2006 03:50 PM
Debug (DLL MFC) -> Debug (Static MFC) ringos75 C++ 0 04-14-2005 01:50 PM
[Howto] Compiling debug Python extensions for non-debug Python Mike C. Fletcher Python 3 10-12-2003 09:37 PM
debug log infrustructure for a library Damien Cymbal Java 1 07-25-2003 06:58 PM



Advertisments
 



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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57