quill
Filter.h
1 
7 #pragma once
8 
9 #include "quill/core/Attributes.h"
10 #include "quill/core/LogLevel.h"
11 
12 #include <cstdint>
13 #include <string>
14 #include <string_view>
15 #include <utility>
16 
17 QUILL_BEGIN_NAMESPACE
18 
19 QUILL_BEGIN_EXPORT
20 
22 class MacroMetadata;
23 
28 class Filter
29 {
30 public:
35  explicit Filter(std::string filter_name) : _filter_name(std::move(filter_name)) {}
36 
40  virtual ~Filter() = default;
41 
56  QUILL_NODISCARD virtual bool filter(MacroMetadata const* log_metadata, uint64_t log_timestamp,
57  std::string_view thread_id, std::string_view thread_name,
58  std::string_view logger_name, LogLevel log_level, std::string_view log_message,
59  std::string_view log_statement) noexcept = 0;
60 
65  QUILL_NODISCARD virtual std::string const& get_filter_name() const noexcept
66  {
67  return _filter_name;
68  }
69 
70 private:
71  std::string _filter_name;
72 };
73 
74 QUILL_END_EXPORT
75 
76 QUILL_END_NAMESPACE
virtual QUILL_NODISCARD bool filter(MacroMetadata const *log_metadata, uint64_t log_timestamp, std::string_view thread_id, std::string_view thread_name, std::string_view logger_name, LogLevel log_level, std::string_view log_message, std::string_view log_statement) noexcept=0
Filters a log message.
virtual ~Filter()=default
Destructor.
Definition: UserDefinedDirectFormatFuzzer.cpp:81
Captures and stores information about a logging event in compile time.
Definition: MacroMetadata.h:24
Base filter class.
Definition: Filter.h:28
Filter(std::string filter_name)
Constructor.
Definition: Filter.h:35
virtual QUILL_NODISCARD std::string const & get_filter_name() const noexcept
Gets the name of the filter.
Definition: Filter.h:65