osm2pgsql-dev / osm2pgsql

OpenStreetMap data to PostgreSQL converter
https://osm2pgsql.org
GNU General Public License v2.0
1.48k stars 473 forks source link

Use a logging library #202

Closed pnorman closed 3 years ago

pnorman commented 9 years ago

Currently everything prints out with fprintf. This makes it hard to change the verbosity.

Any thoughts?

@zerebubuth, do you think MapQuest/logging would be suited here?

alex85k commented 9 years ago

There is always Boost logging somewhere near but it seems to be huge and slow to build. Something smaller would be preferrable (non-professional opinion).

pnorman commented 9 years ago

boost::log was only introduced in 1.54. This is a big minus.

@zerebubuth, I can't remember the options we came up with at the hack weekend.

zerebubuth commented 9 years ago

There's google's logging library too. I've never used it, though, so I can't say whether it's any good.

The MQ logging library is probably no good for now, as it currently depends on mapnik and that's too big of a dep to pull in (imho). On 27 Feb 2015 20:12, "Paul Norman" notifications@github.com wrote:

boost::log was only introduced in 1.54. This is a big minus.

@zerebubuth https://github.com/zerebubuth, I can't remember the options we came up with at the hack weekend.

— Reply to this email directly or view it on GitHub https://github.com/openstreetmap/osm2pgsql/issues/202#issuecomment-76463478 .

pnorman commented 9 years ago

I forgot our library depends on Mapnik. I agree, that rules it out.

log4cxx is another library mentioned, patterned after log4j. log4cxx is packaged on Ubuntu 12.04, 14.04 and FreeBSD

google-glog is Google's. It is packaged on Ubuntu 14.04 and FreeBSD, but not Ubuntu 12.04.

alex85k commented 8 years ago

Maybe use something lighweight and header-only like https://github.com/gabime/spdlog , if you are going to use cppformat anyway https://github.com/openstreetmap/osm2pgsql/issues/398 It would be great to replace boost completely, to my opinion. It is the biggest dependency, after all but used only in few places.

alex85k commented 8 years ago

Another way is to use boost whenever possible, like https://github.com/alacarte-maps/alacarte (just switched from log4cpp to boost log) and https://github.com/Project-OSRM/osrm-backend (including logging, formatting, testing if needed). Performance and compilation time may suffer a little :)

pnorman commented 7 years ago

osmium::util::VerboseOutput might be of use here

pnorman commented 7 years ago

Per previous discussion, we need support for three levels of output - details (off by default), standard, and errors.

We might also have additional debugging output with some compile-time flags (e.g. all COPY lines to postgres)