By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,338 Members | 1,344 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,338 IT Pros & Developers. It's quick & easy.

Log design (serialization)

P: n/a

I'm building a class library that uses the serial port to communicate with a
custom serial bus. Two of the classes I've built ("Packet" and "SerialPort")
uses an aggregated class "Log" to log their activity on a log file.

Now that it is working, I'd like to refactor it so it implements a better
design. What I want to do is instead of coupling a Log class to my Packet
and SerialPort classes, I want to be able to choose what type of log I want
to assign to my serial classes. The options I envision are: 1) A file log;
2) The console; 3) A remote log, that sends a (probably XML) text stream
over the net; 4) A null log, that does nothing when asked to log

I could create a base class for these logs, but then I couldn't use the
standard console (unless my derived class wraps it, which maybe it's not a
bad idea).

I'm a newcomer to the C# world and I only have a vague idea of how
serialization works. I've been investigating the help, but everywhere I look
they implement things using reflection, and I don't know if it is
justifiable in this case.

Do you have any design/implementation suggestions for this app?


Mar 28 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Why not check out log4net? I supports all the loggers you seem to want
and you don't have to spend time rolling your own.

Mar 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.