cleanunicorn/mockprovider

Create a method to enable/disable global logging

Closed this issue · 0 comments

Context

Logging is useful, as well as tricky to debug if a static call is performed to a view or pure method.

A way to enable or disable global logging is also useful when no query was matched and the default response is returned. At the moment, all default queries are also logged.

} else {
// Default to sending the default response
_logCall();

It is useful to create a global flag that enables or disables default logging for the default response.

Additionally, a global logging flag could be forwarded to other methods too, like the one used in givenQueryReturn and givenSelectorReturn.

Details

  • Create a method that enables or disables logging
  • Use the set flag to determine if the call should be logged or not for default responses
  • Use the set flag to determine if the call should be logged or not for other methods that do not have the logging param

Alternatives

Can you achieve the same result doing it in an alternative way? Is the alternative considerable?

Logging can be specified in the more verbose methods like givenQueryReturnResponse, however the purpose of this feature is to be paired with the methods that do not have the logging param.

Has the feature been requested before?

No