Build your own simple logging utility using C#

4/1/2014

Build your own simple logging utility using C#

Logging is actually really important function when you need to build your application. Depend on your application's requirement, it might need to code a lot. For example, you might need to logging exception error to a file at your server machine, or you might want to send that to e-mail, showing it when during debug, showing different case depend on what kinds of value is coming. There're a lot of thing you could do, usually you would use your third-party's logging functions, Like Log4net, Microsoft Enterprise Library..

You could find more like, C# Logger, CommonData, CSharp Dot Net Logger, Debug Writer, Logger.NET, LogThis, logview4net, NetTrace, NLog, NSpring, ObjectGuyFramework, SmartInspect, TcpTrace, Traceract, TraceRT.NET, Traffic Monitor, Nlog, TraceTool, Elmah

So, this's article is about how to build your own logging utility, in the future, I might enhance it to be library, which able to download, if you would like to use it.

1. sample code for main logging logic

yeah, you're right just, write to text file.

2. get method name (might not need)

 

3. logging status enum

You probably need to type of enum

4. hwo to call

 

5. put to library class

 

6. how to put to library class

 

Reference from following links

I'm planning to make easy logging library. If requried, will make it able to download.