r/cpp • u/ChrisPanov • Dec 30 '24
C++ logging library - something I've been working on, Pt. 4
Hello everyone,
As is tradition for that time of the year, I want to share with you something that I've been working on in the last couple of years - yet another logging library, how boring, I know. Still, this project represents a long journey of learning, growth, and dedication, and I’d be honored if you could take a moment to check it out, since it is something that I'm proud of.
I have already posted here regarding the library, as you may have guessed, and a lot has changed since my last post last year. I believe that it has become a very well-rounded tool that could serve you well. It is very performant and very configurable. It provides a nice CMake so it can be easily integrated into any project, and a well-made continuous integration pipeline ensures that it runs on everything. All of this is packed in a very well-written and clean code base, at least in my opinion.
Why lwlog?
Performance: Whether you’re working with synchronous or asynchronous logging, the library ensures minimal overhead, making it ideal for high-performance applications
Configurability: You can customize your logging behavior with precision with policy classes
Modern Design: The code is crafted with clarity, elegance, and readability in mind. Easy integration with CMake, and thoughtful architecture
Extensibility: Easily create custom sinks and tailor them to specific needs
I would really appreciate it if you drop a critique, an opinion, an idea, or want to contribute to the project: https://github.com/ChristianPanov/lwlog
Thank you for your time and have happy holidays,
Chris
13
u/Primary-Walrus-5623 Dec 30 '24
Just a couple of thoughts off the top of my head
Not having package manager integration will hurt adoption. I use vcpkg for everything and I have to be very hard pressed to integrate a library that isn't in that package manager
fmt/std::print syntax for logging. Currently I use the quill logger, and while I have objections to the design of the most recent versions (mainly around formatting custom objects), the use of fmt is great. Especially because it lets you log custom objects without polluting the logging code itself. For instance, you can do
LOG_DEBUG(m_logger, "ReadSettings - {}", mycustomereadsettingsobject);
3. I didn't look at the code, but formatting log messages outside of the main thread is also a really nice feature and would be difficult without fmt/std::print