diff --git a/Libraries/LibCore/Object.cpp b/Libraries/LibCore/Object.cpp index 44ab028de2..df2359e001 100644 --- a/Libraries/LibCore/Object.cpp +++ b/Libraries/LibCore/Object.cpp @@ -264,3 +264,12 @@ const LogStream& operator<<(const LogStream& stream, const Object& object) } } + +namespace AK { + +void Formatter::format(TypeErasedFormatParams& params, FormatBuilder& builder, const Core::Object& value) +{ + Formatter::format(params, builder, String::formatted("{}({})", value.class_name(), &value)); +} + +} diff --git a/Libraries/LibCore/Object.h b/Libraries/LibCore/Object.h index 7577a93876..ce3355e88c 100644 --- a/Libraries/LibCore/Object.h +++ b/Libraries/LibCore/Object.h @@ -170,6 +170,13 @@ private: } +namespace AK { +template<> +struct Formatter : Formatter { + void format(TypeErasedFormatParams&, FormatBuilder&, const Core::Object&); +}; +} + namespace Core { template inline void Object::for_each_child_of_type(Callback callback)