commercialhaskell / rio

A standard library for Haskell
Other
838 stars 54 forks source link

documentation: it's not clear what the "source" argument to logInfoS and friends is for #213

Open robx opened 4 years ago

robx commented 4 years ago

While trying to figure out a nice way to provide context to log messages (e.g., prepend some request-specific prefix in a web handler), I ran across logInfoS. From the documentation, it was entirely unclear to me what this "source" might be. It'd be great to be a bit clearer about this.

(I've since read the source code and think that it's actually never used by log functions created through newLogFunc, so perhaps these might even be dropped? I'm going to assume I'm missing something though. It's possible to make use of the source field via mkLogFunc.)

snoyberg commented 4 years ago

PR to clear up the docs would be great. Source is intended to be a general purpose field for "what part of your application does this come from." For example, you may say source is "database" to distinguish from "web."

robx commented 4 years ago

Thanks for looking into this! Would be happy to provide such a PR, but am still a bit confused.

Is it correct that in order to get the source argument displayed, I would have to create my own log function via mkLogFunction, and not be able to build on top of withLogFunc / newLogFunc? That's how I read the source code...

snoyberg commented 4 years ago

I think so.