olympus-robotics / hephaestus

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

add structured logging proposal #110

Open johannes-graeter opened 2 weeks ago

johannes-graeter commented 2 weeks ago

Description

As discussed in https://github.com/olympus-robotics/hephaestus/issues/86 we want to make the logging more scalable. This is a proposal for adding structured logging. Done:

To be done:

To be discussed: I am not quite satisfied with the interface yet: Log{"msg"}("key",val)("key2",val2) is not super nice. I like [] better but this is only avaliable in c++23. Also map interface has too many brackets in my opinion: Log{"msg"}({{"key",val},{"key2",val2}}) Best solution would be designated initilializers like: Log{"msg"}(.key=val, .key2=val2) But for this I would need reflections to turn the struct fields into json, perhaps possible with c++26...

Checklist before requesting a review