C# Log Roller Class

Class description:

/// This class handles writing to a log file and rolling it based on
/// the file size. Currently you only need to send one parameter to the
/// constructor: the logFullFilePath
///
/// From the logFullFilePath, this class will determine the folder location where
/// to place all logs and the file names for the log files. Log files will be
/// rolled when the file hits 5MB; this will be customizable in the future via
/// constructor parameters or public properties.
///
/// For a logFullFilePath like this one: C:\dir1\dir2\log-file-name.log
///
/// All of the log files will be located in C:\dir1\dir2 , the most recent
/// log file will always be log-file-name.log and once log-file-name.log hits 5MB,
/// it will be renamed log-file-name-01.log and a new log-file-name.log file will
/// be created. Then when log-file-name.log hits 5MB again, log-file-name-01.log
/// will become log-file-name-02.log, log-file-name.log will become log-file-name-01.log
/// and a new log-file-name.log file will be created. And so on…
///
/// Currently you will have 15 log-file-name-NN.log files; but this will be
/// customizeable in the future via constructor parameters or public properties.

So basically you just have to do the following, and this class takes care of rolling the logs for you:

LogRoller roller = new LogRoller("C:\dir1\dir2\log-file-name.log");
while (true)
{
    roller.LogMessage("test message");
    roller.LogException(new ApplicationException("this is an exception");
}

You can find the class here LogRoller.cs