Should library code have logging?

absolutely. but do you want to force your library users to couple their code with your logger? what if you're using log4net v1 and they want to use v2. v2 has breaking changes. now they can't.

that's where a logging abstraction comes in. specifically, LibLog. A library logger.

https://github.com/damianh/LibLog

LibLog supports many 3rd party loggers. It just uses the logger it see's at application start at runtime.

I actually use it in all my projects. Every library and console app. Why? because abstractions are great. If you want to switch from NLog to Serilog, guess what you can, in a few lines of code. compare that to having to edit every single file in every single project and solution.

and with liblog you don't have to edit shit. it picks up the logger you set up and runtime.

its fucking great.

/r/csharp Thread