ThrowAwayLogger: easy log mocking in .NET

ThrowAwayLogger: easy log mocking in .NET

In the past we always had often problems to manage logging mechanisms in unit tests, so I wrote ThrowAwayLogger that solves the problem.

// field
private ILogger _log = new ThrowAwayLogger();

// call
_log.Log(LogLevel.Information, _ex, "Test " + _message);
}

In principle, all this can be implemented via Moq, but there are often cases where validations are not necessary and a simple mock mechanism is sufficient.


ThrowAwayLogger on GitHub