Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change C++ logging library to spdlog or glog #3195

Closed
garth-wells opened this issue May 4, 2024 · 6 comments
Closed

Change C++ logging library to spdlog or glog #3195

garth-wells opened this issue May 4, 2024 · 6 comments

Comments

@garth-wells
Copy link
Member

garth-wells commented May 4, 2024

Some time ago we adopted loguru for C++ logging. At the time we considered several options (see #3). The history is a bit hard to follow, but we did have a PR for using spdlog (#311), but eventually adopted loguru (#417).

A consideration at the time was a reluctance to introduce a substantial dependency that was not widely packaged. loguru is light and we included the source in the DOFLINx tree.

In the meantime,

  • loguru is not actively maintained. The code has many pragmas to ignore compiler warnings, we're having to edit the code to add more as compilers add stricter tests.
  • spdlog and glog are actively maintained and widely used.
  • spdlog and glog are available in conda, brew, Debian/Ubuntu, Spack, vcpkg , and other package managers

Should we switch from loguru to spdlog or glog?

@jhale, @chrisrichardson

@chrisrichardson
Copy link
Contributor

glog is also worth considering. It would be less disruptive as the syntax is the same as what we have in loguru.
loguru works well, so I'd like to confirm that the same or better features exist before switching.

@jhale
Copy link
Member

jhale commented May 14, 2024

I support the change but am also interested in glog.

Both glog and spdlog are available in vcpkg, homebrew, Debian, RedHat, conda (feedstock) and Spack, so no issues there.

glog (unlike spdlog) has a Windows/Visual Studio CI job on Github Actions. It is also a drop in replacement for loguru.

We are not logging heavily in tight loops so performance differences are not hugely important for us.

@chrisrichardson and I have nearly finished the Windows build and have identified loguru as producing strange linking (!) errors when compiling the Python headers. I'm sure this can be fixed, but perhaps the energy is better spent switching quickly to something more modern.

@garth-wells garth-wells changed the title Change C++ logging library to spdlog Change C++ logging library to spdlog or glog May 14, 2024
@garth-wells
Copy link
Member Author

I've updated the title to add glog to spdlog.

@chrisrichardson
Copy link
Contributor

https://github.com/FEniCS/dolfinx/tree/chris/glog - seems an easy drop-in.

@chrisrichardson
Copy link
Contributor

On further testing, I think spdlog is a better choice:
https://github.com/FEniCS/dolfinx/compare/chris/spdlog

@garth-wells
Copy link
Member Author

Switched to spdlog in #3216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants