Is your feature request related to a problem? Please describe.
As a user of this library, I would like verbose debugging available to me.
Describe the solution you'd like
Through the use of a setter, we should be able to set a debug mode. An example could be:
// No debugging
$whmcsApi->setDebugLevel(WHMCSAPI::DEBUG_LEVEL_NONE);
// Some debugging
$whmcsApi->setDebugLevel(WHMCSAPI::DEBUG_LEVEL_BASIC);
// All the debugging!
$whmcsApi->setDebugLevel(WHMCSAPI::DEBUG_LEVEL_VERBOSE);
Debugging can either be echo'd out, or stored in an associative array for retrieval via an additional method:
$whmcsApi->getDebugLog();
Alternatively, we may want to add an additional boolean value to the setDebugLevel() method to provide an output method which would need to conform to a contract:
interface LogCollector {
function write(string $logMessage, string $severity = 'info') {}
function retrieve() {}
This is not exhaustive.
Describe alternatives you've considered
- Providing a plain text log file
- Providing a plain text output
- Providing an accessible associative array of log entries for inspection
Additional context
Debugging can be super important when attempting to utilise a library.