Skip to content

Commit

Permalink
trace log level
Browse files Browse the repository at this point in the history
#feat
  • Loading branch information
alandefreitas committed Jan 28, 2025
1 parent 33b7d5f commit c9f7663
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ if (MRDOCS_BUILD_TESTS)
"--stdlib-includes=${LIBCXX_DIR}"
"--stdlib-includes=${STDLIB_INCLUDE_DIR}"
"--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs"
--report=2
--report=3
)
foreach (action IN ITEMS test create update)
add_custom_target(
Expand All @@ -416,7 +416,7 @@ if (MRDOCS_BUILD_TESTS)
"--stdlib-includes=${LIBCXX_DIR}"
"--stdlib-includes=${STDLIB_INCLUDE_DIR}"
"--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs"
--report=2
--report=3
DEPENDS mrdocs-test
)
endforeach ()
Expand Down
2 changes: 1 addition & 1 deletion docs/mrdocs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
"report": {
"default": 1,
"description": "The reporting level determines the amount of information displayed during the generation of the documentation. The levels are: 0 - no output, 1 - errors only, 2 - errors and warnings, 3 - errors, warnings, and information, 4 - errors, warnings, information, and debug information.",
"maximum": 4,
"maximum": 5,
"minimum": 0,
"title": "The minimum reporting level: 0 to 4",
"type": "integer"
Expand Down
18 changes: 15 additions & 3 deletions include/mrdocs/Support/Error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2665,7 +2665,8 @@ namespace report {
*/
enum class Level
{
debug = 0,
trace = 0,
debug,
info,
warn,
error,
Expand All @@ -2676,6 +2677,7 @@ enum class Level
*/
struct Results
{
std::size_t traceCount;
std::size_t debugCount;
std::size_t infoCount;
std::size_t warnCount;
Expand All @@ -2699,8 +2701,7 @@ results;
*/
MRDOCS_DECL
void
setMinimumLevel(
Level level) noexcept;
setMinimumLevel(Level level) noexcept;

MRDOCS_DECL
Level
Expand Down Expand Up @@ -2825,6 +2826,17 @@ log(
std::forward<Args>(args)...);
}

/** Report a message to the console.
*/
template<class... Args>
void
trace(
Located<std::string_view> format,
Args&&... args)
{
return log(Level::trace, format, std::forward<Args>(args)...);
}

/** Report a message to the console.
*/
template<class... Args>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/AST/ASTVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ checkFileFilters(std::string_view const symbolPath) const

ASTVisitor::ExtractionInfo
ASTVisitor::
checkSymbolFilters(Decl const* D, bool AllowParent)
checkSymbolFilters(Decl const* D, bool const AllowParent)
{
// Use the cache
if (auto const it = extraction_.find(D); it != extraction_.end())
Expand Down
2 changes: 1 addition & 1 deletion src/lib/AST/ClangHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ namespace detail {
#define MRDOCS_SYMBOL_TRACE(D, C) \
SmallString<256> MRDOCS_SYMBOL_TRACE_UNIQUE_NAME; \
detail::printTraceName(D, C, MRDOCS_SYMBOL_TRACE_UNIQUE_NAME); \
report::debug("{}", std::string_view(MRDOCS_SYMBOL_TRACE_UNIQUE_NAME.str()))
report::trace("{}", std::string_view(MRDOCS_SYMBOL_TRACE_UNIQUE_NAME.str()))
#endif

} // clang::mrdocs
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Lib/ConfigOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
"type": "unsigned",
"default": 1,
"min-value": 0,
"max-value": 4
"max-value": 5
},
{
"name": "ignore-map-errors",
Expand Down
6 changes: 4 additions & 2 deletions src/lib/Support/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ print_impl(
}

void
setMinimumLevel(
Level level) noexcept
setMinimumLevel(Level const level) noexcept
{
level_ = level;
}
Expand Down Expand Up @@ -288,6 +287,9 @@ call_impl(
}
switch(level)
{
case Level::trace:
++results.traceCount;
break;
case Level::debug:
++results.debugCount;
break;
Expand Down
6 changes: 2 additions & 4 deletions src/lib/Support/Error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include <ostream>
#include <utility>

namespace clang {
namespace mrdocs {
namespace clang::mrdocs {

namespace report {

Expand Down Expand Up @@ -129,8 +128,7 @@ call(

} // report

} // mrdocs
} // clang
} // clang::mrdocs

template<>
struct fmt::formatter<llvm::StringRef>
Expand Down

0 comments on commit c9f7663

Please sign in to comment.