unsplit icon indicating copy to clipboard operation
unsplit copied to clipboard

Pluggable logging, instead of io:fwrite calls

Open alexthornton1 opened this issue 12 years ago • 1 comments

Hello,

I'm planning to add a feature to 'unsplit' that allows me to plug in a logging function other than io:fwrite (e.g., lager or something custom), with the plugged-in function used throughout all unsplit modules.

The basic plan is to store a setting in the application's env identifying the logging function (a {Module, FunctionName} tuple). A table-specific setting specified in the {user_properties, ...} of a Mnesia table could be used additionally, but that's not something I would find useful for my purposes; if you or the user community thinks that has use, it's something I can tackle.

Calls to io:fwrite and error_logger:format would be replaced with calls to io_lib:format, along with passing the resulting string to whatever log function has been configured (with the default being io:fwrite). Log functions would be expected to have this type specification:

-type unsplit_log_fun() :: fun((string()) -> 'ok').

Pull request forthcoming, but wanted to begin with a heads up, along with my thanks for a very useful project!

  • Alex

alexthornton1 avatar Jan 03 '13 06:01 alexthornton1

Pull request is here. Many thanks!

  • Alex

alexthornton1 avatar Jan 03 '13 08:01 alexthornton1