Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
global_logger_registry.h File Reference

GlobalLoggerRegistry implementation for runtime binding. More...

#include "logger_interface.h"
#include "registry_audit_log.h"
#include <atomic>
#include <functional>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <string>
#include <unordered_map>
Include dependency graph for global_logger_registry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  kcenon::common::interfaces::NullLogger
 A no-op logger implementation for fallback scenarios. More...
 
class  kcenon::common::interfaces::GlobalLoggerRegistry
 Thread-safe singleton registry for managing logger instances. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::common
 Core interfaces.
 
namespace  kcenon::common::interfaces
 

Functions

GlobalLoggerRegistrykcenon::common::interfaces::get_registry ()
 Get the global logger registry instance.
 
std::shared_ptr< ILoggerkcenon::common::interfaces::get_logger ()
 Get the default logger from the global registry.
 
std::shared_ptr< ILoggerkcenon::common::interfaces::get_logger (const std::string &name)
 Get a named logger from the global registry.
 

Detailed Description

GlobalLoggerRegistry implementation for runtime binding.

This header provides a centralized, thread-safe registry for managing logger instances across all subsystems. It resolves the circular dependency between thread_system and logger_system by providing a decoupled logging registry that can be bound at runtime.

Thread Safety:

  • GlobalLoggerRegistry is thread-safe for all operations.
  • Uses std::shared_mutex for read/write locking.
  • Factory-based lazy initialization is protected against race conditions.
  • NullLogger fallback ensures safe operation when no logger is registered.
See also
Issue #174 for implementation requirements.
logger_interface.h for the ILoggerRegistry interface definition.

Definition in file global_logger_registry.h.