BrunoBonacci / mulog

μ/log is a micro-logging library that logs events and data, not words!
https://cljdoc.org/d/com.brunobonacci/mulog/
Apache License 2.0
490 stars 48 forks source link

Put event name in options map #99

Closed sirmspencer closed 2 years ago

sirmspencer commented 2 years ago

For advanced options (ie with :capture), it would be cool if we could add the event name there.

The main reason is to consolidate all of the meta data into one argument, which helps with formatting. We would like to format it more like with-open instead of a function, where the body is indented 2 spaces instead of aligned.

(u/trace {:event ::my-trace
          :pairs [:req-body body]
          :capture (fn [x] {:response x})}
  (do ...))
BrunoBonacci commented 2 years ago

Hi @sirmspencer ,

The reason is in this way is to separate the required parameters from the optional ones. Unfortunately, this wouldn't be possible without breaking changes.

However, one thing you can do is to write a simple macro in your code which could expand your proposed form into u/trace form.