Re:‘Woof’, a pure Scala 3 logging library
by macpete42 on Saturday December 18, 2021 @03:42PM
(#29608326)
Why would I verify logging which itself is a verification instrument? And, seriously, how hard is it to emit a diagnostic message so I need a test for that to get it right?
Re:‘Woof’, a pure Scala 3 logging library
by doikor on Saturday December 18, 2021 @04:05PM
(#29608490)
If you have some rare (rare as in it happens once every few months or something like that) error and you need logging about it. Also testing it ensures nobody by mistake removes that bit of logging by accident.
Re:‘Woof’, a pure Scala 3 logging library
by macpete42 on Saturday December 18, 2021 @04:35PM
(#29608756)
code reviews would probably be a better fit to prevent that.
Don't know about others but for me it is about being able to easily verify that my logging is setup correctly.
Once you write your logging to some monad (the library we use does not require it to be IO) testing it becomes trivial with a WriterT monad where it just write your logs into some list/buffer and check that what was logged in various cases was actually what you wanted.
We do the same with tracing checking that spans are created as we wanted and the tags/logs on the spans are setup correctly.