|
unilink
0.4.3
A simple C++ library for unified async communication
|
Centralized error handling system. More...
#include <error_handler.hpp>
Public Types | |
| using | ErrorCallback = std::function< void(const ErrorInfo &)> |
Public Member Functions | |
| ErrorHandler () | |
| ~ErrorHandler () | |
| void | report_error (const ErrorInfo &error) |
| Report an error. More... | |
| void | register_callback (ErrorCallback callback) |
| Register error callback. More... | |
| void | clear_callbacks () |
| Unregister all callbacks. More... | |
| void | set_min_error_level (ErrorLevel level) |
| Set minimum error level to report. More... | |
| ErrorLevel | get_min_error_level () const |
| Get current minimum error level. More... | |
| void | set_enabled (bool enabled) |
| Enable/disable error reporting. More... | |
| bool | is_enabled () const |
| Check if error reporting is enabled. More... | |
| ErrorStats | get_error_stats () const |
| Get error statistics. More... | |
| void | reset_stats () |
| Reset error statistics. More... | |
| std::vector< ErrorInfo > | get_errors_by_component (std::string_view component) const |
| Get errors by component. More... | |
| std::vector< ErrorInfo > | get_recent_errors (size_t count=10) const |
| Get recent errors. More... | |
| bool | has_errors (std::string_view component) const |
| Check if component has any errors. More... | |
| size_t | get_error_count (std::string_view component, ErrorLevel level) const |
| Get error count for specific component and level. More... | |
Static Public Member Functions | |
| static ErrorHandler & | instance () |
| Get singleton instance. More... | |
| static ErrorHandler & | default_handler () |
Centralized error handling system.
Provides thread-safe error reporting, statistics collection, and callback-based error handling for the entire unilink library.
Definition at line 39 of file error_handler.hpp.
| using unilink::diagnostics::ErrorHandler::ErrorCallback = std::function<void(const ErrorInfo&)> |
Definition at line 41 of file error_handler.hpp.
|
default |
|
default |
| void unilink::diagnostics::ErrorHandler::clear_callbacks | ( | ) |
Unregister all callbacks.
Definition at line 65 of file error_handler.cc.
|
static |
Definition at line 33 of file error_handler.cc.
| size_t unilink::diagnostics::ErrorHandler::get_error_count | ( | std::string_view | component, |
| ErrorLevel | level | ||
| ) | const |
Get error count for specific component and level.
| component | Component name |
| level | Error level |
Definition at line 115 of file error_handler.cc.
| ErrorStats unilink::diagnostics::ErrorHandler::get_error_stats | ( | ) | const |
Get error statistics.
Definition at line 78 of file error_handler.cc.
| std::vector< ErrorInfo > unilink::diagnostics::ErrorHandler::get_errors_by_component | ( | std::string_view | component | ) | const |
Get errors by component.
| component | Component name to filter by |
Definition at line 88 of file error_handler.cc.
| ErrorLevel unilink::diagnostics::ErrorHandler::get_min_error_level | ( | ) | const |
Get current minimum error level.
Definition at line 72 of file error_handler.cc.
| std::vector< ErrorInfo > unilink::diagnostics::ErrorHandler::get_recent_errors | ( | size_t | count = 10 | ) | const |
Get recent errors.
| count | Maximum number of recent errors to return |
Definition at line 97 of file error_handler.cc.
| bool unilink::diagnostics::ErrorHandler::has_errors | ( | std::string_view | component | ) | const |
Check if component has any errors.
| component | Component name to check |
Definition at line 109 of file error_handler.cc.
|
static |
Get singleton instance.
Definition at line 38 of file error_handler.cc.
| bool unilink::diagnostics::ErrorHandler::is_enabled | ( | ) | const |
Check if error reporting is enabled.
Definition at line 76 of file error_handler.cc.
| void unilink::diagnostics::ErrorHandler::register_callback | ( | ErrorCallback | callback | ) |
Register error callback.
| callback | Function to call when errors occur |
Definition at line 60 of file error_handler.cc.
| void unilink::diagnostics::ErrorHandler::report_error | ( | const ErrorInfo & | error | ) |
Report an error.
| error | Error information to report |
Definition at line 40 of file error_handler.cc.
| void unilink::diagnostics::ErrorHandler::reset_stats | ( | ) |
Reset error statistics.
Definition at line 83 of file error_handler.cc.
| void unilink::diagnostics::ErrorHandler::set_enabled | ( | bool | enabled | ) |
Enable/disable error reporting.
| enabled | True to enable, false to disable |
Definition at line 74 of file error_handler.cc.
| void unilink::diagnostics::ErrorHandler::set_min_error_level | ( | ErrorLevel | level | ) |
Set minimum error level to report.
| level | Minimum level (errors below this level are ignored) |
Definition at line 70 of file error_handler.cc.