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

LogManager singleton — central registry of named spdlog channels with lazy creation, per-channel and prefix-based level control, listener-based capture, and structured LogEvent metadata. More...

#include <logman/env_prefixes.hpp>
#include <logman/formatters.hpp>
#include <logman/init_config.hpp>
#include <logman/listener_sink.hpp>
#include <logman/log_event.hpp>
#include <spdlog/pattern_formatter.h>
#include <spdlog/sinks/sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <algorithm>
#include <cctype>
#include <cstddef>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <memory>
#include <mutex>
#include <optional>
#include <ranges>
#include <shared_mutex>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
Include dependency graph for log_manager.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  logman::LogManager
 Central registry of named spdlog channels. More...
 

Functions

template<typename Cb >
void logman::detail::enumerate_env (Cb &&cb)
 Iterate the process environment, calling cb(name, value) for each entry.
 
std::optional< spdlog::level::level_enum > logman::parse_level_value (const std::string_view value)
 Parse a level name (case-insensitive).
 
std::string logman::env_suffix_to_channel_prefix (const std::string_view suffix)
 Convert the <NAMESPACE> part of an env var name (e.g.
 

Detailed Description

LogManager singleton — central registry of named spdlog channels with lazy creation, per-channel and prefix-based level control, listener-based capture, and structured LogEvent metadata.

Function Documentation

◆ env_suffix_to_channel_prefix()

std::string logman::env_suffix_to_channel_prefix ( const std::string_view  suffix)
inline

Convert the <NAMESPACE> part of an env var name (e.g.

ORG_FOO_MANAGER) to a channel-prefix string (e.g. org.foo.manager). Lowercases everything and replaces underscores with dots; leading and trailing underscores collapse to empty segments (acceptable: the result is still a valid starts_with prefix).

◆ parse_level_value()

std::optional< spdlog::level::level_enum > logman::parse_level_value ( const std::string_view  value)
inline

Parse a level name (case-insensitive).

Accepts the standard spdlog set: trace, debug, info, warn, warning, err, error, critical, off. Returns nullopt for anything else.