Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Add debug logging #198

@PeteBishwhip

Description

@PeteBishwhip

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

  1. Providing a plain text log file
  2. Providing a plain text output
  3. Providing an accessible associative array of log entries for inspection

Additional context
Debugging can be super important when attempting to utilise a library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions