Separating Logging Code from C# Objects

Viewed 1768

Currently I have a custom built static logging class in C# that can be called with the following code:

EventLogger.Log(EventLogger.EventType.Application, string.Format("AddData request from {0}", ipAddress));

When this is called it simply writes to a defined log file specified in a configuration file.

However, being that I have to log many, many events, my code is starting to become hard to read because all of the logging messages.

Is there an established way to more or less separate logging code from objects and methods in a C# class so code doesn't become unruly?

Thank you all in advance for your help as this is something I have been struggling with lately.

7 Answers
Related