Add debug logging facility

This commit is contained in:
Jonathan Müller 2017-04-06 12:09:29 +02:00
commit da5b46fdb7
4 changed files with 27 additions and 0 deletions

View file

@ -74,6 +74,15 @@ std::unique_ptr<cpp_entity> detail::parse_entity(const detail::parse_context& co
const CXCursor& cur,
const CXCursor& parent_cur) try
{
if (context.logger->is_verbose())
{
auto message = detail::format("parsing cursor of type '",
detail::get_cursor_kind_spelling(cur).c_str(), "'");
context.logger->log("libclang parser",
diagnostic{std::move(message), detail::make_location(cur),
severity::debug});
}
auto kind = clang_getCursorKind(cur);
switch (kind)
{

View file

@ -15,6 +15,8 @@ bool diagnostic_logger::log(const char* source, const diagnostic& d) const
{
if (d.severity == severity::error)
error_ = true;
else if (!verbose_ && d.severity == severity::debug)
return false;
return do_log(source, d);
}