Skip to content

Commit 3f24987

Browse files
fpelliccionialandefreitas
authored andcommitted
feat: uniform logging level control across CorpusImpl
1 parent 9d30ea1 commit 3f24987

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

src/lib/Lib/CorpusImpl.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ format_duration(
101101
mrdocs::Expected<std::unique_ptr<Corpus>>
102102
CorpusImpl::
103103
build(
104-
report::Level reportLevel,
105104
std::shared_ptr<ConfigImpl const> const& config,
106105
tooling::CompilationDatabase const& compilations)
107106
{
@@ -159,7 +158,7 @@ build(
159158
// ------------------------------------------
160159
// Traverse the AST for all translation units.
161160
// This operation happens on a thread pool.
162-
report::print(reportLevel, "Extracting declarations");
161+
report::info("Extracting declarations");
163162

164163
// Get a copy of the filename strings
165164
std::vector<std::string> files = compilations.getAllFiles();
@@ -187,15 +186,14 @@ build(
187186
taskGroup.async(
188187
[&, idx = ++index, path = std::move(file)]()
189188
{
190-
report::log(reportLevel,
191-
"[{}/{}] \"{}\"", idx, files.size(), path);
189+
report::debug("[{}/{}] \"{}\"", idx, files.size(), path);
192190
processFile(path);
193191
});
194192
}
195193
errors = taskGroup.wait();
196194
}
197195
// Print diagnostics totals
198-
context.reportEnd(reportLevel);
196+
context.reportEnd(report::Level::info);
199197

200198
// ------------------------------------------
201199
// Report warning and error totals
@@ -216,7 +214,7 @@ build(
216214
return Unexpected(results.error());
217215
corpus->info_ = std::move(results.value());
218216

219-
report::log(reportLevel,
217+
report::info(
220218
"Extracted {} declarations in {}",
221219
corpus->info_.size(),
222220
format_duration(clock_type::now() - start_time));

src/lib/Lib/CorpusImpl.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class CorpusImpl : public Corpus
7979
instance will be already populated. They will
8080
not need to call this function directly.
8181
82-
@param reportLevel Error reporting level.
8382
@param config A shared pointer to the configuration.
8483
@param compilations A compilations database for the input files.
8584
*/
@@ -88,7 +87,6 @@ class CorpusImpl : public Corpus
8887
static
8988
mrdocs::Expected<std::unique_ptr<Corpus>>
9089
build(
91-
report::Level reportLevel,
9290
std::shared_ptr<ConfigImpl const> const& config,
9391
tooling::CompilationDatabase const& compilations);
9492

src/test/TestRunner.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ handleFile(
112112
MrDocsCompilationDatabase compilations(
113113
llvm::StringRef(parentDir), SingleFileDB(filePath), config, defaultIncludePaths);
114114

115+
report::setMinimumLevel(report::Level::warn);
115116
// Build Corpus
116-
auto corpus = CorpusImpl::build(
117-
report::Level::debug, config, compilations);
117+
auto corpus = CorpusImpl::build(config, compilations);
118118
if(! corpus)
119119
return report::error("{}: \"{}\"", corpus.error(), filePath);
120120

src/tool/GenerateAction.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ DoGenerateAction(
186186
// --------------------------------------------------------------
187187
MRDOCS_TRY(
188188
std::unique_ptr<Corpus> corpus,
189-
CorpusImpl::build(
190-
report::Level::info, config, compilationDatabase));
189+
CorpusImpl::build(config, compilationDatabase));
191190
if (corpus->empty())
192191
{
193192
report::warn("Corpus is empty, not generating docs");

0 commit comments

Comments
 (0)