Closed edwintorok closed 8 years ago
Kind of agree with you. I'll see if that's workable, and switch to that asap. Thanks for the feedback.
I think this could also allow to remove the Logs.unit
for constant formats, since there will always be at least one unlabelled argument to m
.
I have a branch here that does that. I quite like the result since it removes the need for Logs.unit
and generally simplifies the interface. I still need to update the documentation properly and my own code and then I'll merge that in master.
So I merged this into master. I'd say that the code looks much better in general. However we loose the ability to abstract logging instruction e.g.:
let log_err_whatever = Logs.err fmt
So I'm still a little bit undecided.
Isn't it possible to implement the old signature on top of the new one?
let old_log_err fmt f = Logs.err (fun m -> f (m fmt));
Perhaps you could provide a variant of kmsg
with the old semantics implemented on top of the new kmsg
, then users of Logs can decide which one is more convenient to use in their abstract logging instructions.
I think I'll simply document the pattern for partially applying the formatter which is basically as you mention:
let log_err_bla m = Logs.err (fun m' -> m (m' $FMT))
I'd like to be able to write something like:
Instead of:
It seems more natural to keep the format string and arguments together, although I'm not sure how this change would affect the internals of Logs.