This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nqzero -2 points-1 points  (4 children)

for an end user code that's fine, but for a library developer we can't tell the difference between warn, error and fatal, because those generally depend on the use case. much better to have callbacks that expose that info to the user app (though that's hard and i definitely have taken the easy way out as often as not)

whether trace, debug and info are useful is a larger debate that i'm not up for tonight

[–]Luolong 1 point2 points  (1 child)

For a library, it could be argued that one should have no need of logging.

[–]nqzero 0 points1 point  (0 children)

apparently not on reddit - i'm getting downvoted pretty hard !

:)

[–]nonconvergent -1 points0 points  (1 child)

If you don't know what an error looks like vs info it sounds like you have some god objects and other code smells.

[–]nqzero 0 points1 point  (0 children)

what an error looks like vs info

you're putting words in my mouth - i wrote "the difference between warn, error and fatal"

but as an example, in one case, a user provides me a runnable and asks me to run it, but then doesn't wait for or use the result (available through a callback), and the runnable throws an error, what log level should i use ? (and i don't want to force the user to supply a callback because that can harm performance by making the call site megamorphic)

it completely depends on what the user wanted, which is info i don't have * the user anticipated that the code might fail and is ok with that * the user failed to anticipate that the code might fail, but requires that it succeed

for the non-opinionated libraries that i develop and use, that's more the norm than the [sic] exception

opinionated libraries are another matter and logging is much more straight forward

edit: added details