public function format($level, $message, array $context = array())
    {
        if (!is_object($message)) {
            return $this->formatter->format('', $message, $context);
        }

        //Mark this object as processed so we don't convert it twice and it
        //Also avoid recursion when objects refer to each other
        $this->_processed[] = $message;

        $object_as_array = array();

        // first add the class name
        $object_as_array['___class_name'] = get_class($message);

        // loop through object vars
        $object_vars = get_object_vars($message);

        foreach ($object_vars as $key => $value) {
            // same instance as parent object
            if ($value === $message || in_array($value, $this->_processed, true)) {
                $value = 'recursion - parent object [' . get_class($value) . ']';
            }
            $object_as_array[$key] = $this->format('', $value, $context);
        }

        $reflection = new ReflectionClass($message);

        // loop through the properties and add those
        foreach ($reflection->getProperties() as $property) {
            // if one of these properties was already added above then ignore it
            if (array_key_exists($property->getName(), $object_vars)) {
                continue;
            }

            $type = $this->getPropertyKey($property);
            if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
                $property->setAccessible(true);
            }

            try {
                $value = $property->getValue($message);
            } catch (ReflectionException $e) {
                $value = 'only PHP 5.3 can access private/protected properties';
            }

            // same instance as parent object
            if ($value === $message || in_array($value, $this->_processed, true)) {
                $value = 'recursion - parent object [' . get_class($value) . ']';
            }

            // Next line changed from original project
            $object_as_array[$type] = $this->formatObjectHandleArray($value, $context);
        }

        return array($object_as_array);
    }