MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / Message

Method Message

src/ifcparse/IfcLogger.cpp:157–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void Logger::Message(Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
158 if (type < verbosity_) {
159 return;
160 }
161
162 static std::mutex mtx;
163 std::lock_guard<std::mutex> lock(mtx);
164
165 if (type == LOG_PERF) {
166 if (!first_timepoint_) {
167 first_timepoint_ = std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
168 }
169 double t0 = (std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count() - *first_timepoint_) / 1.e9;
170 if (message.substr(0, 5) == "done ") {
171 auto orig = message.substr(5);
172 performance_statistics_[orig] += t0 - performance_signal_start_[orig];
173 } else {
174 performance_signal_start_[message] = t0;
175 }
176 }
177
178 if (type > max_severity_) {
179 max_severity_ = type;
180 }
181 if (((log2_ != nullptr) || (wlog2_ != nullptr))) {
182 if (format_ == FMT_PLAIN) {
183 if (log2_ != nullptr) {
184 plain_text_message(*log2_, current_product_, type, message, instance);
185 } else if (wlog2_ != nullptr) {
186 plain_text_message(*wlog2_, current_product_, type, message, instance);
187 }
188 } else if (format_ == FMT_JSON) {
189 if (log2_ != nullptr) {
190 json_message(*log2_, current_product_, type, message, instance);
191 } else if (wlog2_ != nullptr) {
192 json_message(*wlog2_, current_product_, type, message, instance);
193 }
194 }
195 }
196}
197
198void Logger::Message(Logger::Severity type, const std::exception& exception, const IfcUtil::IfcBaseInterface* instance) {
199 Message(type, std::string(exception.what()), instance);

Callers

nothing calls this directly

Calls 6

plain_text_messageFunction · 0.85
json_messageFunction · 0.85
MessageClass · 0.85
substrMethod · 0.80
whatMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected