Skip to content

Commit 5a4532b

Browse files
committed
Adjust std output
1 parent 049873c commit 5a4532b

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

importer/src/hierarchy.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ void Hierarchy::finalize()
114114
}
115115

116116
std::cout << "Hierarchy: active items: " << index - 1
117-
<< " / cleared items: " << m_items.size() - (index - 1) << std::flush;
117+
<< " / cleared items: " << m_items.size() - (index - 1) << "\n";
118118
}
119119

120-
bool Hierarchy::check_indexing()
120+
bool Hierarchy::check_indexing(bool verbose)
121121
{
122122
std::cout << "Check whether all items are indexed\n";
123123

@@ -129,27 +129,35 @@ bool Hierarchy::check_indexing()
129129
if (item->keep(false) && !item->indexed())
130130
{
131131
isok = false;
132-
std::cout << "\nItem is not included into hierarchy while it should be\n";
133-
item->print_item(0);
132+
if (verbose)
133+
{
134+
std::cout << "\nItem is not included into hierarchy while it should be\n";
135+
item->print_item(0);
134136

135-
std::cout << "\nItem part of hierarchy (child -> parent):\n";
137+
std::cout << "\nItem part of hierarchy (child -> parent):\n";
138+
}
136139

137140
auto i = item;
138141
std::set<hindex> ids;
139142
for (auto parent = item->parent_id(); parent != 0; parent = i->parent_id())
140143
{
141144
if (m_items.find(parent) == m_items.end())
142145
{
146+
// those are not expected to be many, keeping message
143147
std::cout << "\nCannot find parent with ID " << parent << "\n";
144148
break;
145149
}
146150

147151
i = m_items[parent];
148-
i->print_item(0);
152+
153+
if (verbose)
154+
i->print_item(0);
149155

150156
if (ids.count(i->id()) > 0)
151157
{
152-
std::cout << "\nCyclic branch detected\n";
158+
if (verbose)
159+
std::cout << "\nCyclic branch detected\n";
160+
153161
m_index_check_failed.insert(ids.begin(), ids.end());
154162
break;
155163
}

importer/src/hierarchy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Hierarchy
2323
void set_country(const std::string &country, hindex id);
2424
void cleanup();
2525
void finalize();
26-
bool check_indexing();
26+
bool check_indexing(bool verbose = false);
2727
void write(sqlite3pp::database &db) const;
2828

2929
size_t get_missing_count() const { return m_root.size(); }

0 commit comments

Comments
 (0)