Simple, Reliable, Fast.
Caution
This library is still in development and is not yet considered a beta version.
- Description
- Features
- Requirements
- Supported Platform and Compilers
- Quick Start
- Documentation
- Contribute
- Roadmap
The main goal of this library is to provide a reliable general purpose logging system for C++ applications, that can be use in most scenarios avoiding to switch between different loggers or changing the code. It's simple to start with and to integrate, it's extensible, still being very fast (benchmark).
- Logger's Registry (default/optional) to ensure loggers/synks life cycle and address the Static Destruction Order Fiasco without leakages
- Sync (default/optional) if thread safe is not enabled,
<mutex>andheaders are not include<thread> - Async (optional) lock-free hot path with low latency on user application
- Unified Interface for Sync and Async
- Thread Safe (optional) thread safe needs to be enabled only for sync mode, for async mode it's just redundant
- 5 different log levels
extesible(FATAL, ERROR, WARNING, INFO, DEBUG) - Compile-Time Log Levels
- Runtime Log Levels (Registry -> Logger -> Sink)
Fast compilation C++ 20 modules- Backpressure Policies (async mode only) extensible
- Sinks extensible (you don't need to worry about thread
safety implementation)
- Console Sink (built-in)
- Stream Sink (built-in/optional)
- File Sink (built-in/optional)
- Custom Sinks
- Logging Stream Syntax (default/optional) it's possible to completely strip out the logging stream syntax
- Logging Format Strings Syntax (default)
<format> - Unified Interface for Logging
- No external Dependencies (except for test suites that are not enabled by default)
- C++ 20+
- Linux
- Windows
MacOS (Todo: test)
- gcc (13+)
- clang (Todo: check minimun version)
- msvc (Todo: check minimun version)
Note
Quick start imply using the library as header only library the project CmakeLists.txt but only -ISLog/include, hence compiling with the macro SLOG_HEADER_ONLY. In alternative it's possible to include the CMakeLists.txt in your project and use it as a header only or static/shared library leveraging the SLOG_BUILD_TYPE option check compile-time options
Clone the repository
git clone https://github.com/SaverioCode/SLog.git#include <slog.hpp>
int main()
{
SLOG_INFO("Hello World {}", 42);
SLOG_INFO() << "Hello World " << 42;
}Or alternative
#include <slog.hpp>
int main()
{
slog::Logger logger = slog::Registry::instance()->get_default_logger();
logger.info("Hello World {}", 42);
logger.info() << "Hello World " << 42;
}Both code snippets use the default logger named "default".
// Todo
Suggestion and contribution are welcome! Just contact me and I'll be glad to answer you
- Implement Worker (BackgroundWorker)
- Integrate Worker in Logger
- Implement Signal Handler
- Implement Format Layout
- Implement Log Rotation
- Implement optional colors for the different logs levels (console ouotput)
- Implement SAST tests
- Implement CI/CD for SAST tests
- Implement Benchmark
- Implement fuzzing tests
- Update tests CI/CD for fuzzing test
- Improve test suites
- Improve performance
- Update CI/CD for MacOS ?
- Write Wiki
- Implement conan package
- Implement custom LogLevels. Discuss if it's a good idea. and eventually do it.
- Implement TCP Sink
- Implement UDP Sink
- Evaluate if implementing Reentrancy guard