logman 0.1.0
Modern C++23 header-only logging manager wrapping spdlog with channels, listeners, and structured events
Loading...
Searching...
No Matches
listener_sink.hpp File Reference

ListenerSink — spdlog sink that dispatches each log record to registered listener callbacks as LogEvent values. More...

#include <logman/log_event.hpp>
#include <spdlog/details/log_msg.h>
#include <spdlog/sinks/base_sink.h>
#include <spdlog/spdlog.h>
#include <atomic>
#include <cstdint>
#include <exception>
#include <functional>
#include <iostream>
#include <mutex>
#include <ranges>
#include <typeinfo>
#include <unordered_map>
#include <vector>
Include dependency graph for listener_sink.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  logman::ListenerSink
 spdlog sink that dispatches every record to a list of user-registered listener callbacks as LogEvent values. More...
 

Functions

int logman::detail::current_pid () noexcept
 Platform-portable PID accessor.
 
LogEvent logman::detail::make_log_event (const spdlog::details::log_msg &msg, const std::string_view formatted_message)
 Build a LogEvent from a spdlog log_msg.
 

Detailed Description

ListenerSink — spdlog sink that dispatches each log record to registered listener callbacks as LogEvent values.

Function Documentation

◆ current_pid()

int logman::detail::current_pid ( )
inlinenoexcept

Platform-portable PID accessor.

Defined inline (not static) so the linker dedups across translation units in this header-only library.

◆ make_log_event()

LogEvent logman::detail::make_log_event ( const spdlog::details::log_msg &  msg,
const std::string_view  formatted_message 
)
inline

Build a LogEvent from a spdlog log_msg.

The formatted_message view becomes the event's message field — callers format with their own formatter and pass the rendered output here.