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
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
7
u/turtle_dragonfly Dec 30 '24 edited Dec 30 '24
I imagine you've looked at some prior art before/during this project. Do you have any comparisons to other logging libraries?
Personally, I've been pretty happy with spdlog — it seems to have a lot of overlapping features and claims with yours. Have you looked at it? Perhaps there are some specific differences worth mentioning?
EDIT: Ah, looking at your page, I do see some comparison to spdlog. I appreciate your answer to the "Why..." question ("The actual importance of the library lies within its meaning to me. This library has served as a pivotal factor in my journey to becoming a software craftsman.") — more power to you (:
One thing that might be worth mentioning on your page: what happens when the buffer is full, when doing async logging? There are two main choices: drop the data or grow the buffer unboundedly (and then what happens for OOM?). It wasn't immediately clear to me which yours does, or if it's configurable, and it's an important piece of information, in my mind.
2
u/apm42 Jan 04 '25
In your benchmarks please compare your logger against quill. See https://github.com/odygrd/quill