This implementation of Log can be thought of as a simple wrapper around the TextWriterLog. It will create a StreamWriter: around the passed in file path. The file can either be appended to or truncated when the FileLog is created.

FileLog is NOT thread safe by default. It will not stop multiple threads from writing the file at the same time. You should wrap a LockingLog around the FileLog to get thread safety.


FileLog log = new FileLog("path\to\log\my_log.log"); // append is implied
FileLog log = new FileLog("path\to\log\my_log.log", true); // append is explicit
FileLog log = new FileLog("path\to\log\my_log.log", false); // truncates the file

Last edited Feb 12, 2009 at 8:25 PM by justrudd, version 2


No comments yet.