This story is unavailable.

It’s funny because I recently came across the same problem (a class with a logger param whose logs must sometimes be discarded, for example during tests) and what I ended up using was a Null Object ( On my particular case, I created a NullLogger class with the same interface as any other regular logger, but all its methods were empty. The optional param did not default to null. Instead, it defaulted to a new instance of NullLogger.

I guess what I did was always requiring a cat, but if you didn’t include yours I was providing a fat lazy cat who didn’t catch any mice and only slept all day. But it was still a cat.