Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
error_handling_utils.h File Reference

Structured error context for debugging log system failures. More...

#include <kcenon/logger/core/error_codes.h>
#include <kcenon/common/config/feature_flags.h>
#include <filesystem>
#include <system_error>
#include <chrono>
#include <sstream>
#include <iostream>
Include dependency graph for error_handling_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kcenon::logger::utils::error_context
 Structured error context for debugging. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::logger
 
namespace  kcenon::logger::utils
 

Macros

#define LOGGER_HAS_SOURCE_LOCATION   KCENON_HAS_SOURCE_LOCATION
 

Functions

void kcenon::logger::utils::log_error_context (const error_context &context)
 Log error to stderr with context.
 
template<typename F >
common::VoidResult kcenon::logger::utils::try_write_operation (F &&operation, logger_error_code default_error_code=logger_error_code::file_write_failed)
 Error handling helper for write operations.
 
template<typename F >
common::VoidResult kcenon::logger::utils::try_open_operation (F &&operation)
 Error handling helper for file open operations.
 
template<typename F >
common::VoidResult kcenon::logger::utils::try_network_operation (F &&operation)
 Error handling helper for network operations.
 
template<typename F >
common::VoidResult kcenon::logger::utils::try_encryption_operation (F &&operation)
 Error handling helper for encryption operations.
 
common::VoidResult kcenon::logger::utils::check_condition (bool condition, logger_error_code error_code, const std::string &message)
 Condition verification helper.
 
template<typename Stream >
common::VoidResult kcenon::logger::utils::check_stream_state (const Stream &stream, const std::string &operation_name="operation")
 Stream state verification helper.
 
common::VoidResult kcenon::logger::utils::check_file_exists (const std::filesystem::path &path)
 File existence verification helper.
 
common::VoidResult kcenon::logger::utils::ensure_directory_exists (const std::filesystem::path &dir)
 Directory creation helper.
 
template<typename F >
void kcenon::logger::utils::safe_destructor_operation (const std::string &operation_name, F &&operation) noexcept
 Safe operation execution for destructors.
 
template<typename F >
void kcenon::logger::utils::safe_destructor_result_operation (const std::string &operation_name, F &&operation) noexcept
 Safe operation with result for destructors.
 

Detailed Description

Structured error context for debugging log system failures.

Definition in file error_handling_utils.h.

Macro Definition Documentation

◆ LOGGER_HAS_SOURCE_LOCATION

#define LOGGER_HAS_SOURCE_LOCATION   KCENON_HAS_SOURCE_LOCATION

Definition at line 27 of file error_handling_utils.h.