Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
kcenon::logger::function_filter Class Reference

Filter logs by custom function. More...

#include <log_filter.h>

Inheritance diagram for kcenon::logger::function_filter:
Inheritance graph
Collaboration diagram for kcenon::logger::function_filter:
Collaboration graph

Public Types

using filter_function
 

Public Member Functions

 function_filter (filter_function func)
 
bool should_log (log_level level, const std::string &message, const std::string &file, int line, const std::string &function) const override
 Check if a log entry should be processed (legacy API)
 
std::string get_name () const override
 Get the name of this filter.
 
- Public Member Functions inherited from kcenon::logger::log_filter
virtual ~log_filter ()=default
 
virtual bool should_log (const log_entry &entry) const override
 Check if a log entry should be processed (new interface)
 
- Public Member Functions inherited from kcenon::logger::log_filter_interface
virtual ~log_filter_interface ()=default
 

Private Attributes

filter_function filter_func_
 

Detailed Description

Filter logs by custom function.

Definition at line 136 of file log_filter.h.

Member Typedef Documentation

◆ filter_function

Initial value:
std::function<bool(log_level,
const std::string&,
const std::string&,
int,
const std::string&)>

Definition at line 138 of file log_filter.h.

Constructor & Destructor Documentation

◆ function_filter()

kcenon::logger::function_filter::function_filter ( filter_function func)
inlineexplicit

Definition at line 144 of file log_filter.h.

145 : filter_func_(std::move(func)) {}

Member Function Documentation

◆ get_name()

std::string kcenon::logger::function_filter::get_name ( ) const
inlineoverridevirtual

Get the name of this filter.

Returns
Filter name for identification

Reimplemented from kcenon::logger::log_filter.

Definition at line 155 of file log_filter.h.

155 {
156 return "function_filter";
157 }

◆ should_log()

bool kcenon::logger::function_filter::should_log ( log_level level,
const std::string & message,
const std::string & file,
int line,
const std::string & function ) const
inlineoverridevirtual

Check if a log entry should be processed (legacy API)

Parameters
levelLog level
messageLog message
fileSource file
lineSource line
functionFunction name
Returns
true if the log should be processed

Implements kcenon::logger::log_filter.

Definition at line 147 of file log_filter.h.

151 {
152 return filter_func_(level, message, file, line, function);
153 }

References filter_func_.

Member Data Documentation

◆ filter_func_

filter_function kcenon::logger::function_filter::filter_func_
private

Definition at line 160 of file log_filter.h.

Referenced by should_log().


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