We currently use Settings().verbose to log calls to each dcli function. This is meant to provide a similar service to bash's set -x flag.
One problem with this method is that it builds a string on every call to verbose even if logging is suppressed.
If we change the call to use a callback mechanism then I think the string building would only occur when logging is enabled.
So the following:
Settings().verbose('Log me quickly $pwd');
becomes:
Settings().verbose(() => 'Log me quickly $pwd');
This should be done in conjunction with a review of how we log. We really need to look at selecting a logging framework which we use and recommend.
It would be nice if there was something similar to java slf4j-api.logger which is able to work with an array of logging provider. This allows the user to choose their logger and dcli would then log via that provider. This may not be possible without using mirrors which I would prefer to avoid.
We currently use Settings().verbose to log calls to each dcli function. This is meant to provide a similar service to bash's set -x flag.
One problem with this method is that it builds a string on every call to verbose even if logging is suppressed.
If we change the call to use a callback mechanism then I think the string building would only occur when logging is enabled.
So the following:
becomes:
This should be done in conjunction with a review of how we log. We really need to look at selecting a logging framework which we use and recommend. It would be nice if there was something similar to java slf4j-api.logger which is able to work with an array of logging provider. This allows the user to choose their logger and dcli would then log via that provider. This may not be possible without using mirrors which I would prefer to avoid.