From 7bea054c1e1f104018d452f170a7e22fd44dc93c Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 19 Aug 2017 16:54:06 +0200 Subject: [PATCH] get_log in python --- src/ifcopenshell-python/ifcopenshell/__init__.py | 1 + src/ifcwrap/IfcParseWrapper.i | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index 0141a43359..a16a20e100 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -70,3 +70,4 @@ def create_entity(type,*args,**kwargs): version = ifcopenshell_wrapper.version() schema_identifier = ifcopenshell_wrapper.schema_identifier() get_supertype = ifcopenshell_wrapper.get_supertype +get_log = ifcopenshell_wrapper.get_log diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index ec8b3f4722..b554b67e56 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -445,4 +445,18 @@ private: IfcSchema::Type::PopulateDerivedFields(data); return IfcSchema::SchemaEntity(data); } +%} + +%{ + static std::stringstream ifcopenshell_log_stream; +%} +%init %{ + Logger::SetOutput(0, &ifcopenshell_log_stream); +%} +%inline %{ + std::string get_log() { + std::string log = ifcopenshell_log_stream.str(); + ifcopenshell_log_stream.str(""); + return log; + } %} \ No newline at end of file