protected function convertToString(LogMessageInterface $logMessage)
    {

        // initialize the variable for the log output
        $output = '';

        // dump the log message
        $this->dumper->dump(
            $this->cloner->cloneVar($logMessage->getMessage()),
            function ($line, $depth) use (&$output) {
                // a negative depth means "end of dump"
                if ($depth >= 0) {
                    // adds a two spaces indentation to the line
                    $output .= str_repeat('  ', $depth) . $line . PHP_EOL;
                }
            }
        );

        // return the log output
        return rtrim($output, PHP_EOL);
    }