473,382 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

debug log infrustructure for a library

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.
Jul 19 '05 #1
1 1859
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.



Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: John Smith | last post by:
After reading C# documentation the Conditional attribute seemed the way to go, but after inspecting the IL it seems those methods are still there and I imagine the CLR removes them. Using #if DEBUG...
4
by: jim | last post by:
I am trying to debug a user written web control and web control designer. I found an article “Building Windows Forms Controls and Component with Rich Design-Time Features” that describes how...
3
by: Rena | last post by:
Hi all, I have created a app. project and a library which will be used by the main project, however i do not know how to get into debug mode inside the library, although break point is set. is...
5
by: Billy | last post by:
Hi! How can I override "Debug.Writeline("Message")" so that will not show that msg in Debug window, but wrote it to a file. I already have a code to write to a file but I would like to use just...
2
by: steve bull | last post by:
how can I debug a code library using C# 2005 Express? I cannot find any way to make the library debuggable - even when I set DEBUG and No Optimize on the debug panel of the code library's property...
1
by: joemynz | last post by:
Help please with a URLError. Invoking a url that works in Firefox and IE results in a "urlerror 7, no address ..." in python. I need to debug why. Traceback is below. There's a redirect when the...
6
by: Andrew Rowley | last post by:
I am having trouble getting debug and release builds to work properly with project references using C++ .NET and Visual Studio 2003. I created a test solution, with a basic Windows form C++...
5
by: sujeet | last post by:
Dear friends, I'm facing a strange problem... My Application is in Debug mode, and the third party static library i'm using is in release mode. When i compile and try to link my...
2
by: Dave Johansen | last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio 2005 and the Debug mode seems to be running just fine, but the Release mode crashes on the following code: std::ifstream...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.