Skip to content
/ logrin Public

πŸ»β€β„οΈπŸ³οΈβ€βš§οΈ Modern, async-aware C++20 logging framework

License

Notifications You must be signed in to change notification settings

auguwu/logrin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ»β€β„οΈπŸ³οΈβ€βš§οΈ Logrin

Modern, async-aware logging framework for C++20

Logrin is a newer, modern, async-aware logging framework for C++20. It was designed and built to provide rich, structured, contextual-aware diagnostics for C++ applications with feature parity of Go's logrus and Rust's tracing libraries.

Features

  • Structured Logging
    • key/value pairs attached to log records
  • Multiple Backends / Sinks
    • Console (human-readable, prettified)
    • JSON logs (for structured output)
    • Custom sinks via logrin::Sink
  • Asynchronous first
    • Non-blocking log emission with logrin::AsyncSink
    • Optional batching for high-performance output
  • Extensible
    • Easily add new sinks or custom log processing
    • Minimal dependencies
    • No RTTI or exceptions required (exception-free mode supported)

Examples

Single-logger construction

#include <logrin/Sinks/Console/Formatter/Json.h>
#include <logrin/Sinks/Console.h>
#include <logrin/Logger.h>

using logrin::sinks::Console;
using logrin::sinks::console::formatters::Json;

logrin::Logger log("a logger");
log.AddSink(Console{}.WithFormatter<Json>());

logger.Info("logrin was initialized");
logger.Debug("disk is almost full", FIELD("disk", "/dev/sda1"));

Logging factory

#include <logrin/Sinks/Console/Formatter/Json.h>
#include <logrin/Sinks/Console.h>
#include <logrin/LogFactory.h>

using logrin::sinks::console::formatters::Json;

auto* console = new logrin::sinks::Console();
console->WithFormatter<Json>();

logrin::LogFactory::Init({
    // the factory will own this allocation and on shutdown, it'll flush
    // any output and deallocate the memory
    console
});

auto log = logrin::LogFactory::Get("a logger");
LOG_INFO(log, "logrin was initialized");
LOG_DEBUG(log, "disk is almost full", FIELD("disk", "/dev/sda1"));

License

logrin is released under the MIT License, view the LICENSE file for more information.

About

πŸ»β€β„οΈπŸ³οΈβ€βš§οΈ Modern, async-aware C++20 logging framework

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

  •