Skip to content

Commit c9f7663

Browse files
committed
trace log level
#feat
1 parent 33b7d5f commit c9f7663

File tree

8 files changed

+27
-15
lines changed

8 files changed

+27
-15
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ if (MRDOCS_BUILD_TESTS)
401401
"--stdlib-includes=${LIBCXX_DIR}"
402402
"--stdlib-includes=${STDLIB_INCLUDE_DIR}"
403403
"--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs"
404-
--report=2
404+
--report=3
405405
)
406406
foreach (action IN ITEMS test create update)
407407
add_custom_target(
@@ -416,7 +416,7 @@ if (MRDOCS_BUILD_TESTS)
416416
"--stdlib-includes=${LIBCXX_DIR}"
417417
"--stdlib-includes=${STDLIB_INCLUDE_DIR}"
418418
"--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs"
419-
--report=2
419+
--report=3
420420
DEPENDS mrdocs-test
421421
)
422422
endforeach ()

docs/mrdocs.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@
239239
"report": {
240240
"default": 1,
241241
"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.",
242-
"maximum": 4,
242+
"maximum": 5,
243243
"minimum": 0,
244244
"title": "The minimum reporting level: 0 to 4",
245245
"type": "integer"

include/mrdocs/Support/Error.hpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,7 +2665,8 @@ namespace report {
26652665
*/
26662666
enum class Level
26672667
{
2668-
debug = 0,
2668+
trace = 0,
2669+
debug,
26692670
info,
26702671
warn,
26712672
error,
@@ -2676,6 +2677,7 @@ enum class Level
26762677
*/
26772678
struct Results
26782679
{
2680+
std::size_t traceCount;
26792681
std::size_t debugCount;
26802682
std::size_t infoCount;
26812683
std::size_t warnCount;
@@ -2699,8 +2701,7 @@ results;
26992701
*/
27002702
MRDOCS_DECL
27012703
void
2702-
setMinimumLevel(
2703-
Level level) noexcept;
2704+
setMinimumLevel(Level level) noexcept;
27042705

27052706
MRDOCS_DECL
27062707
Level
@@ -2825,6 +2826,17 @@ log(
28252826
std::forward<Args>(args)...);
28262827
}
28272828

2829+
/** Report a message to the console.
2830+
*/
2831+
template<class... Args>
2832+
void
2833+
trace(
2834+
Located<std::string_view> format,
2835+
Args&&... args)
2836+
{
2837+
return log(Level::trace, format, std::forward<Args>(args)...);
2838+
}
2839+
28282840
/** Report a message to the console.
28292841
*/
28302842
template<class... Args>

src/lib/AST/ASTVisitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2594,7 +2594,7 @@ checkFileFilters(std::string_view const symbolPath) const
25942594

25952595
ASTVisitor::ExtractionInfo
25962596
ASTVisitor::
2597-
checkSymbolFilters(Decl const* D, bool AllowParent)
2597+
checkSymbolFilters(Decl const* D, bool const AllowParent)
25982598
{
25992599
// Use the cache
26002600
if (auto const it = extraction_.find(D); it != extraction_.end())

src/lib/AST/ClangHelpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ namespace detail {
972972
#define MRDOCS_SYMBOL_TRACE(D, C) \
973973
SmallString<256> MRDOCS_SYMBOL_TRACE_UNIQUE_NAME; \
974974
detail::printTraceName(D, C, MRDOCS_SYMBOL_TRACE_UNIQUE_NAME); \
975-
report::debug("{}", std::string_view(MRDOCS_SYMBOL_TRACE_UNIQUE_NAME.str()))
975+
report::trace("{}", std::string_view(MRDOCS_SYMBOL_TRACE_UNIQUE_NAME.str()))
976976
#endif
977977

978978
} // clang::mrdocs

src/lib/Lib/ConfigOptions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@
368368
"type": "unsigned",
369369
"default": 1,
370370
"min-value": 0,
371-
"max-value": 4
371+
"max-value": 5
372372
},
373373
{
374374
"name": "ignore-map-errors",

src/lib/Support/Error.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ print_impl(
186186
}
187187

188188
void
189-
setMinimumLevel(
190-
Level level) noexcept
189+
setMinimumLevel(Level const level) noexcept
191190
{
192191
level_ = level;
193192
}
@@ -288,6 +287,9 @@ call_impl(
288287
}
289288
switch(level)
290289
{
290+
case Level::trace:
291+
++results.traceCount;
292+
break;
291293
case Level::debug:
292294
++results.debugCount;
293295
break;

src/lib/Support/Error.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
#include <ostream>
2121
#include <utility>
2222

23-
namespace clang {
24-
namespace mrdocs {
23+
namespace clang::mrdocs {
2524

2625
namespace report {
2726

@@ -129,8 +128,7 @@ call(
129128

130129
} // report
131130

132-
} // mrdocs
133-
} // clang
131+
} // clang::mrdocs
134132

135133
template<>
136134
struct fmt::formatter<llvm::StringRef>

0 commit comments

Comments
 (0)