public function debug($message = true, array $context = [])
    {
        // using this to switch on/off the debug for this object
        if (is_bool($message)) {
            $this->debug = $message;

            return $this;
        }

        // if debug is enabled, then log it
        if ($this->debug) {
            if (!isset($this->app) || !isset($this->app->logger) || !$this->app->logger instanceof \Psr\Log\LoggerInterface) {
                $message = '['.get_class($this).']: '.$message;
            }
            $this->log(LogLevel::DEBUG, $message, $context);
        }

        return $this;
    }