Skip to content

feat(logging): add unified logging macros and helper functions #175

Description

@kcenon

Summary

Implement logging macros and convenience functions for consistent use across all systems.

Tasks

1. Inline Logging Functions

  • Create include/kcenon/common/logging/log_functions.h
namespace kcenon::common::logging {
    void log(log_level level, std::string_view message,
             std::source_location loc = std::source_location::current());

    void log_trace(std::string_view msg, std::source_location loc = ...);
    void log_debug(std::string_view msg, std::source_location loc = ...);
    void log_info(std::string_view msg, std::source_location loc = ...);
    void log_warning(std::string_view msg, std::source_location loc = ...);
    void log_error(std::string_view msg, std::source_location loc = ...);
    void log_critical(std::string_view msg, std::source_location loc = ...);
}

2. Macro Definitions

  • Create include/kcenon/common/logging/log_macros.h
#define LOG_TRACE(msg)    ::kcenon::common::logging::log_trace(msg)
#define LOG_DEBUG(msg)    ::kcenon::common::logging::log_debug(msg)
#define LOG_INFO(msg)     ::kcenon::common::logging::log_info(msg)
#define LOG_WARNING(msg)  ::kcenon::common::logging::log_warning(msg)
#define LOG_ERROR(msg)    ::kcenon::common::logging::log_error(msg)
#define LOG_CRITICAL(msg) ::kcenon::common::logging::log_critical(msg)

3. Legacy Compatibility Macros

  • Redirect THREAD_LOG_* macros to LOG_*

Test Requirements

  • Test each log level function
  • Test source_location automatic capture
  • Test macro behavior

Related Milestone

Metadata

Metadata

Assignees

Labels

ci-cdCI/CD and build automationenhancementNew feature or requestloggingLogging related changesthreadingThreading and concurrency

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions