WolfireGames / overgrowth

Open Source codebase of the game Overgrowth by Wolfire Games LLC
Apache License 2.0
2.51k stars 260 forks source link

Use fmt for logging instead of streams #28

Open turol opened 2 years ago

turol commented 2 years ago

The current logging framework uses streams. They're all around terrible, hard to read and slow. Replace with fmtlib.

feliwir commented 2 years ago

Not a fan to be honest. The fmt lib can increase compiletime quiet badly at times and is kind of obsolet with C++20 formatting library (which is a 1:1 replacement): https://en.cppreference.com/w/cpp/utility/format

turol commented 2 years ago

I don't think the steam runtime compiler supports C++20.

shinymerlyn commented 2 years ago

Maybe there's a backport that can be used? agree that iostreams generally sucks. agree that anything that increases compile times significantly should be avoided too.

turol commented 2 years ago

fmt is the backport/prototype before standardization. I have used it in several projects and haven't noticed any compile time increases.

turol commented 2 years ago

Just ran a quick test. Simplish "hello world", compile time: 0.04 seconds for C printf, 0.20 seconds for iostreams 0.34 seconds for fmt No quite as fast but not excessive either.

feliwir commented 2 years ago

We can use the fmt lib (i'm a fan of it myself, just wanted to point out the compiletime aspect). It's great since it's standard compatible and it probably won't make a large difference in compilation times. Once C++ 20 gets more mature and is compatible with the steam runtime we have a nice upgrade path.

autious commented 2 years ago

I'd say go ahead and bring in fmtlib. It can takes years before the steam runtime supports C++ 20