Skip to content

Commit 0a23889

Browse files
authored
Merge pull request #1347 from joto/log-levels
Sort out log levels of all log messages
2 parents 6fb0e8a + 42ef2bc commit 0a23889

12 files changed

+36
-48
lines changed

src/expire-tiles.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ tile_output_t::tile_output_t(char const *filename)
3232
: outfile(fopen(filename, "a"))
3333
{
3434
if (outfile == nullptr) {
35-
log_error("Failed to open expired tiles file ({}). Tile expiry "
36-
"list will not be written!",
37-
std::strerror(errno));
35+
log_warn("Failed to open expired tiles file ({}). Tile expiry "
36+
"list will not be written!",
37+
std::strerror(errno));
3838
}
3939
}
4040

@@ -354,9 +354,9 @@ void expire_tiles::from_wkb_polygon(ewkb::parser_t *wkb, osmid_t osm_id)
354354

355355
if (from_bbox(min.x, min.y, max.x, max.y)) {
356356
/* Bounding box too big - just expire tiles on the line */
357-
log_info("Large polygon ({:.0f} x {:.0f} metres, OSM ID {})"
358-
" - only expiring perimeter",
359-
max.x - min.x, max.y - min.y, osm_id);
357+
log_debug("Large polygon ({:.0f} x {:.0f} metres, OSM ID {})"
358+
" - only expiring perimeter",
359+
max.x - min.x, max.y - min.y, osm_id);
360360
wkb->rewind(start);
361361
for (unsigned ring = 0; ring < num_rings; ++ring) {
362362
from_wkb_line(wkb);

src/flex-table.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void table_connection_t::stop(bool updateable, bool append)
210210

211211
sql += " ORDER BY ";
212212
if (postgis_version.major == 2 && postgis_version.minor < 4) {
213-
log_info("Using GeoHash for clustering");
213+
log_debug("Using GeoHash for clustering");
214214
if (table().geom_column().srid() == 4326) {
215215
sql += "ST_GeoHash({},10)"_format(table().geom_column().name());
216216
} else {
@@ -220,7 +220,7 @@ void table_connection_t::stop(bool updateable, bool append)
220220
}
221221
sql += " COLLATE \"C\"";
222222
} else {
223-
log_info("Using native order for clustering");
223+
log_debug("Using native order for clustering");
224224
// Since Postgis 2.4 the order function for geometries gives
225225
// useful results.
226226
sql += table().geom_column().name();
@@ -273,7 +273,7 @@ void table_connection_t::prepare()
273273
void table_connection_t::create_id_index()
274274
{
275275
if (m_id_index_created) {
276-
log_info("Id index on table '{}' already created.", table().name());
276+
log_debug("Id index on table '{}' already created.", table().name());
277277
} else {
278278
log_info("Creating id index on table '{}'...", table().name());
279279
m_db_connection->exec(table().build_sql_create_id_index());

src/middle-pgsql.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ void middle_query_pgsql_t::exec_sql(std::string const &sql_cmd) const
8888
void middle_pgsql_t::table_desc::stop(std::string const &conninfo,
8989
bool droptemp, bool build_indexes)
9090
{
91-
log_info("Stopping table: {}", name());
9291
util::timer_t timer;
9392

9493
// Use a temporary connection here because we might run in a separate
9594
// thread context.
9695
pg_conn_t sql_conn{conninfo};
9796

9897
if (droptemp) {
98+
log_info("Dropping table: {}", name());
9999
auto const qual_name = qualified_name(
100100
m_copy_target->schema, m_copy_target->name);
101101
sql_conn.exec("DROP TABLE IF EXISTS {}"_format(qual_name));
@@ -104,7 +104,7 @@ void middle_pgsql_t::table_desc::stop(std::string const &conninfo,
104104
sql_conn.exec(m_create_fw_dep_indexes);
105105
}
106106

107-
log_info("Stopped table: {} in {}", name(),
107+
log_info("Done postprocessing table: {} in {}", name(),
108108
util::human_readable_duration(timer.stop()));
109109
}
110110

@@ -575,7 +575,7 @@ void middle_pgsql_t::start()
575575
// (Re)create tables.
576576
m_db_connection.exec("SET client_min_messages = WARNING");
577577
for (auto const &table : m_tables) {
578-
log_info("Setting up table: {}", table.name());
578+
log_debug("Setting up table: {}", table.name());
579579
auto const qual_name = qualified_name(
580580
table.m_copy_target->schema, table.m_copy_target->name);
581581
m_db_connection.exec(
@@ -755,7 +755,7 @@ middle_pgsql_t::middle_pgsql_t(options_t const *options)
755755
m_persistent_cache.reset(new node_persistent_cache{options, m_cache});
756756
}
757757

758-
log_info("Mid: pgsql, cache={}", options->cache);
758+
log_debug("Mid: pgsql, cache={}", options->cache);
759759

760760
bool const has_bucket_index =
761761
check_bucket_index(&m_db_connection, options->prefix);

src/node-persistent-cache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ node_persistent_cache::node_persistent_cache(
5252

5353
m_fname = options->flat_node_file->c_str();
5454
m_remove_file = options->droptemp;
55-
log_info("Mid: loading persistent node cache from {}", m_fname);
55+
log_debug("Mid: loading persistent node cache from {}", m_fname);
5656

5757
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-signed-bitwise)
5858
m_fd = open(m_fname, O_RDWR | O_CREAT, 0644);
@@ -74,7 +74,7 @@ node_persistent_cache::~node_persistent_cache() noexcept
7474

7575
if (m_remove_file) {
7676
try {
77-
log_info("Mid: removing persistent node cache at {}", m_fname);
77+
log_debug("Mid: removing persistent node cache at {}", m_fname);
7878
} catch (...) {
7979
}
8080
unlink(m_fname);

src/node-ram-cache.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ node_ram_cache::node_ram_cache(int strategy, int cacheSizeMB)
306306
maxSparseTuples = (cacheSize / sizeof(ramNodeID)) + 1;
307307

308308
if ((allocStrategy & ALLOC_DENSE) > 0) {
309-
log_info("Allocating memory for dense node cache");
309+
log_debug("Allocating memory for dense node cache");
310310
blocks = (ramNodeBlock *)calloc(num_blocks(), sizeof(ramNodeBlock));
311311
if (!blocks) {
312312
throw std::runtime_error{
@@ -319,12 +319,12 @@ node_ram_cache::node_ram_cache(int strategy, int cacheSizeMB)
319319
* once it is needed.
320320
*/
321321
if ((allocStrategy & ALLOC_DENSE_CHUNK) > 0) {
322-
log_info("Allocating dense node cache in block sized chunks");
322+
log_debug("Allocating dense node cache in block sized chunks");
323323
if (!queue) {
324324
throw std::runtime_error{"Out of memory, reduce --cache size."};
325325
}
326326
} else {
327-
log_info("Allocating dense node cache in one big chunk");
327+
log_debug("Allocating dense node cache in one big chunk");
328328
blockCache = (char *)malloc((maxBlocks + 1024) * per_block() *
329329
sizeof(osmium::Location));
330330
if (!queue || !blockCache) {
@@ -343,12 +343,12 @@ node_ram_cache::node_ram_cache(int strategy, int cacheSizeMB)
343343
*/
344344

345345
if ((allocStrategy & ALLOC_SPARSE) > 0) {
346-
log_info("Allocating memory for sparse node cache");
346+
log_debug("Allocating memory for sparse node cache");
347347
if (!blockCache) {
348348
sparseBlock =
349349
(ramNodeID *)malloc(maxSparseTuples * sizeof(ramNodeID));
350350
} else {
351-
log_info("Sharing dense sparse");
351+
log_debug("Sharing dense sparse");
352352
sparseBlock = (ramNodeID *)blockCache;
353353
}
354354
if (!sparseBlock) {

src/options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static osmium::Box parse_bbox(char const *bbox)
357357
"Bounding box failed due to maxlat <= minlat."};
358358
}
359359

360-
log_info("Applying bounding box: {},{} to {},{}", minx, miny, maxx, maxy);
360+
log_debug("Applying bounding box: {},{} to {},{}", minx, miny, maxx, maxy);
361361

362362
return osmium::Box{minx, miny, maxx, maxy};
363363
}

src/osm2pgsql.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ prepare_input_files(options_t const &options)
7575
"Reading an OSM change file only works in append mode."};
7676
}
7777

78-
log_info("Reading file: {}", filename);
78+
log_debug("Reading file: {}", filename);
7979

8080
files.emplace_back(file);
8181
}

src/osmdata.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,8 @@ class multithreaded_processor
470470
{
471471
auto const ids_queued = list.size();
472472

473-
if (get_logger().show_progress()) {
474-
fmt::print(stderr, "\nGoing over pending {}s...\n", type);
475-
fmt::print(stderr, "\t{} {}s are pending\n", ids_queued, type);
476-
fmt::print(stderr, "\nUsing {} helper-processes\n",
477-
m_clones.size());
478-
}
473+
log_info("Going over {} pending {}s (using {} threads)"_format(
474+
ids_queued, type, m_clones.size()));
479475

480476
util::timer_t timer;
481477
std::vector<std::future<void>> workers;
@@ -503,16 +499,12 @@ class multithreaded_processor
503499
timer.stop();
504500

505501
if (get_logger().show_progress()) {
506-
fmt::print(stderr, "\rFinished processing {} {}s in {}\n\n",
507-
ids_queued, type,
508-
util::human_readable_duration(timer.elapsed()));
502+
fmt::print(stderr, "\rLeft to process: 0.");
509503
}
510504

511-
if (timer.elapsed() > 0) {
512-
log_info("{} pending {}s took {} at a rate of {:.2f}/s", ids_queued,
513-
type, util::human_readable_duration(timer.elapsed()),
514-
timer.per_second(ids_queued));
515-
}
505+
log_info("{} pending {}s took {} at a rate of {:.2f}/s", ids_queued,
506+
type, util::human_readable_duration(timer.elapsed()),
507+
timer.per_second(ids_queued));
516508
}
517509

518510
/// Clones of all outputs, one vector of clones per thread.

src/output-flex.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,6 @@ void output_flex_t::reprocess_marked()
15111511
log_info("Reprocess marked ways (stage 2)...");
15121512

15131513
if (!m_options.append) {
1514-
log_info("Creating id indexes...");
15151514
util::timer_t timer;
15161515

15171516
for (auto &table : m_table_connections) {

src/output-pgsql.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ output_pgsql_t::output_pgsql_t(
344344
buffer(32768, osmium::memory::Buffer::auto_grow::yes),
345345
rels_buffer(1024, osmium::memory::Buffer::auto_grow::yes)
346346
{
347-
log_info("Using projection SRS {} ({})", o.projection->target_srs(),
348-
o.projection->target_desc());
347+
log_debug("Using projection SRS {} ({})", o.projection->target_srs(),
348+
o.projection->target_desc());
349349

350350
export_list exlist;
351351

0 commit comments

Comments
 (0)