olympus-robotics / hephaestus

Hephaestus is a C++ framework designed to facilitate robotics development by providing commonly needed functionality and abstractions.
MIT License
17 stars 2 forks source link

[Utils] Add macro to simplify logging #86

Open filippobrizzi opened 2 weeks ago

filippobrizzi commented 2 weeks ago

Right now we do:

LOG(INFO) << fmt::format("foo {}", foo);

this is quite verbose, and we should replace with something like:

LOG(INFO, "foo {}", foo);
johannes-graeter commented 2 weeks ago

I am a big fan of spdlog, since its done with good style and can be pretty powerful (dumping accumulated logs f.e., having special sinks, customizing rotation), while being quite fast. Also you can customize the output format a lot and it uses natively fmt.

While touching logging: I found structured logging incredibly helpful (like f.e. https://github.com/sirupsen/logrus) especially when logs start to be organized with grafana and cohorts.

I would be interested to structured logging with spdlog as a backend... What do you think?

filippobrizzi commented 1 week ago

I never used spdlog but it seems a valid alternatives, the reason why I started with Absil log is that we had absil anyway and wanted to avoid an extra logging library. Absil main limitation I see is that it doesn't support natively fmt, but other than that you can write all the customization and sink that you like.

Regarding structured logging we are currently investigating various options, starting with OpenTelemetry, but I am open to other options. If you think that we can have structured logging with spdlog and Influxdb backend to log on grafana and you would like to make a small demo that would be awesome!!