So regards logging from SO and other sites on the Internet the best response seems to be:
void DoSomething() {
Logger.Log(\"Doing something!\");
// Code.
I would probably have a separate body of unit tests for the logger itself, to test out its various functions separately from everything else. In methods that are using the logger, I would just test that the logger was invoked (i.e. expect that it was called) with the right parameters. For example, if I have a method:
DoSomething()
{
if (FatalErrorOccurred)
{
Logger.Log("Fatal Error", ErrorLevel.Fatal);
}
}
I would write a test that shows the logger logged a fatal error message when FatalErrorOccurred was true. I would not, of course, test the contents of the error message itself, as that is very susceptible to change.