Skip to content
Note

Think it’s necessary to mock ILogger?

Think it’s necessary to mock ILogger?

Using Moq or NSubstitute to do this? Think again.

In the C# world, many developers do this - but there’s a more efficient way.

Enter NullLogger.

NullLogger, a minimalist logger from Microsoft, lets you fulfill your dependency without any fuss. All while doing… well, nothing.

Creating an instance? It’s as simple as ‘NullLogger.Instance’.

Give it a try next time you’re coding. You might just find it changes your approach completely.

So, who’s ready to ditch the old method and embrace NullLogger?

Earns Its Keep

Every Sunday, one post on Dataverse, .NET, and whether the tools we rely on still deserve to be there.