Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
kcenon::logger::routing::router_builder::regex_condition Class Reference
Inheritance diagram for kcenon::logger::routing::router_builder::regex_condition:
Inheritance graph
Collaboration diagram for kcenon::logger::routing::router_builder::regex_condition:
Collaboration graph

Public Member Functions

 regex_condition (const std::string &pattern)
 
bool should_log (const log_entry &entry) const override
 Check if a log entry should be processed.
 
std::string get_name () const override
 Get the name of this filter.
 
- Public Member Functions inherited from kcenon::logger::log_filter_interface
virtual ~log_filter_interface ()=default
 

Private Attributes

std::regex pattern_
 

Detailed Description

Definition at line 156 of file log_router.h.

Constructor & Destructor Documentation

◆ regex_condition()

kcenon::logger::routing::router_builder::regex_condition::regex_condition ( const std::string & pattern)
inlineexplicit

Definition at line 160 of file log_router.h.

Member Function Documentation

◆ get_name()

std::string kcenon::logger::routing::router_builder::regex_condition::get_name ( ) const
inlineoverridevirtual

Get the name of this filter.

Returns
Filter name for identification

Implements kcenon::logger::log_filter_interface.

Definition at line 168 of file log_router.h.

168 {
169 return "regex_condition";
170 }

◆ should_log()

bool kcenon::logger::routing::router_builder::regex_condition::should_log ( const log_entry & entry) const
inlineoverridevirtual

Check if a log entry should be processed.

Parameters
entryThe log entry to check
Returns
true if the entry should be logged, false otherwise

Implements kcenon::logger::log_filter_interface.

Definition at line 162 of file log_router.h.

162 {
163 // Use implicit conversion to string_view
164 std::string_view msg_view = entry.message;
165 return std::regex_search(msg_view.begin(), msg_view.end(), pattern_);
166 }

References kcenon::logger::log_entry::message, and pattern_.

Member Data Documentation

◆ pattern_

std::regex kcenon::logger::routing::router_builder::regex_condition::pattern_
private

Definition at line 158 of file log_router.h.

Referenced by should_log().


The documentation for this class was generated from the following file: