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

Public Member Functions

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
 

Detailed Description

Examples
security_demo.cpp.

Definition at line 39 of file security_demo.cpp.

Member Function Documentation

◆ get_name()

std::string security_filter::get_name ( ) const
inlineoverridevirtual

Get the name of this filter.

Returns
Filter name for identification

Implements kcenon::logger::log_filter_interface.

Examples
security_demo.cpp.

Definition at line 52 of file security_demo.cpp.

52 {
53 return "security_filter";
54 }

◆ should_log()

bool security_filter::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.

Examples
security_demo.cpp.

Definition at line 41 of file security_demo.cpp.

41 {
42 const std::string message = entry.message.to_string();
43
44 // Block logs containing passwords
45 if (message.find("password") != std::string::npos) {
46 std::cout << "[SECURITY] Blocked log containing password" << std::endl;
47 return false;
48 }
49 return true;
50 }
std::string to_string() const
Convert to std::string.
small_string_256 message
The actual log message.
Definition log_entry.h:169

References kcenon::logger::log_entry::message, and kcenon::logger::small_string< SSO_SIZE >::to_string().

Here is the call graph for this function:

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