public static function prepareMessage($message)
    {
        if (method_exists($message, '__toString')) {
            return $message->__toString();
        }

        if (is_scalar($message)) {
            return (string)$message;
        }

        if (class_exists(VarDumper::class)) {
            return VarDumper::export($message);
        }

        throw new InvalidArgumentException('The log message MUST be a string or object implementing __toString()');
    }