Reputation: 461
I've been using the global module Log.Global
and the functions info
and debug
but my application is growing larger and I need more flexibility. Specifically, I'd like to be able to enable/disable events from different components of the system. I'm wondering what is considering best practice in general (I mention Async
since it's the API I'm using but the question is more general).
It seems the API provides at least two ways to do it. There is a ?tags:(string * string) list
optional parameters. When used, it appends tags after the log message.
2017-08-23 17:35:38.090225+07:00 Info starting my program -- [foobar: foobar]
I could use that and then filter my log based on the events I want to see. How are tags used in general, are they typically literals or are there other ways of using them?
I could also use more than one logger. For instance, the functor Make_global () : Global_intf
creates singleton. I could create one logger for each component. Is there a good reason to choose this approach? besides having different output for each log and setting the log level independently.
Upvotes: 4
Views: 324