11#include " flex-table.hpp"
22#include " format.hpp"
3+ #include " logging.hpp"
34#include " pgsql-helper.hpp"
45#include " util.hpp"
56
@@ -174,8 +175,8 @@ void table_connection_t::start(bool append)
174175
175176 for (auto const &column : table ()) {
176177 if (res.get_column_number (column.name ()) < 0 ) {
177- fmt::print (stderr, " Adding new column '{}' to '{}'\n " ,
178- column. name (), table ().name ());
178+ log_info ( " Adding new column '{}' to '{}'" , column. name () ,
179+ table ().name ());
179180 m_db_connection->exec (
180181 " ALTER TABLE {} ADD COLUMN \" {}\" {}" _format (
181182 table ().full_name (), column.name (),
@@ -204,8 +205,7 @@ void table_connection_t::stop(bool updateable, bool append)
204205 util::timer_t timer;
205206
206207 if (table ().has_geom_column ()) {
207- fmt::print (stderr, " Clustering table '{}' by geometry...\n " ,
208- table ().name ());
208+ log_info (" Clustering table '{}' by geometry..." , table ().name ());
209209
210210 // Notices about invalid geometries are expected and can be ignored
211211 // because they say nothing about the validity of the geometry in OSM.
@@ -229,7 +229,7 @@ void table_connection_t::stop(bool updateable, bool append)
229229
230230 sql += " ORDER BY " ;
231231 if (postgis_version.major == 2 && postgis_version.minor < 4 ) {
232- fmt::print (stderr, " Using GeoHash for clustering\n " );
232+ log_info ( " Using GeoHash for clustering" );
233233 if (table ().geom_column ().srid () == 4326 ) {
234234 sql += " ST_GeoHash({},10)" _format (table ().geom_column ().name ());
235235 } else {
@@ -239,7 +239,7 @@ void table_connection_t::stop(bool updateable, bool append)
239239 }
240240 sql += " COLLATE \" C\" " ;
241241 } else {
242- fmt::print (stderr, " Using native order for clustering\n " );
242+ log_info ( " Using native order for clustering" );
243243 // Since Postgis 2.4 the order function for geometries gives
244244 // useful results.
245245 sql += table ().geom_column ().name ();
@@ -252,8 +252,7 @@ void table_connection_t::stop(bool updateable, bool append)
252252 table ().full_tmp_name (), table ().name ()));
253253 m_id_index_created = false ;
254254
255- fmt::print (stderr, " Creating geometry index on table '{}'...\n " ,
256- table ().name ());
255+ log_info (" Creating geometry index on table '{}'..." , table ().name ());
257256
258257 // Use fillfactor 100 for un-updateable imports
259258 m_db_connection->exec (
@@ -273,11 +272,11 @@ void table_connection_t::stop(bool updateable, bool append)
273272 }
274273 }
275274
276- fmt::print (stderr, " Analyzing table '{}'...\n " , table ().name ());
275+ log_info ( " Analyzing table '{}'..." , table ().name ());
277276 m_db_connection->exec (" ANALYZE " + table ().full_name ());
278277
279- fmt::print (stderr, " All postprocessing on table '{}' done in {}.\n " ,
280- table (). name (), util::human_readable_duration (timer.stop ()));
278+ log_info ( " All postprocessing on table '{}' done in {}." , table (). name () ,
279+ util::human_readable_duration (timer.stop ()));
281280
282281 teardown ();
283282}
@@ -293,11 +292,9 @@ void table_connection_t::prepare()
293292void table_connection_t::create_id_index ()
294293{
295294 if (m_id_index_created) {
296- fmt::print (stderr, " Id index on table '{}' already created.\n " ,
297- table ().name ());
295+ log_info (" Id index on table '{}' already created." , table ().name ());
298296 } else {
299- fmt::print (stderr, " Creating id index on table '{}'...\n " ,
300- table ().name ());
297+ log_info (" Creating id index on table '{}'..." , table ().name ());
301298 m_db_connection->exec (table ().build_sql_create_id_index ());
302299 m_id_index_created = true ;
303300 }
0 commit comments