Skip to content

SaverioCode/SLog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SLog

License Linux Windows

Simple, Reliable, Fast.

Caution

This library is still in development and is not yet considered a beta version.

Table of Contents

Description

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).

Features

  • 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> and <thread> headers are not include
  • 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)

Requirements

  • C++ 20+

Supported Platforms and Compilers

Platforms

  • Linux
  • Windows
  • MacOS (Todo: test)

Compilers

  • gcc (13+)
  • clang (Todo: check minimun version)
  • msvc (Todo: check minimun version)

Quick Start

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

1. Installation

Clone the repository

git clone https://github.com/SaverioCode/SLog.git

2. Base Usage

#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".

Wiki

// Todo

Contribute

Suggestion and contribution are welcome! Just contact me and I'll be glad to answer you

Roadmap

  • 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published