How to logs in C# program

How can I log my working like OB2. I have also looked at the OB2 source, but didn’t understand anything.