IBR-DTN  1.0.0
LogFilter.h
Go to the documentation of this file.
1 /*
2  * LogFilter.h
3  *
4  * Copyright (C) 2014 IBR, TU Braunschweig
5  *
6  * Written-by: Johannes Morgenroth <jm@m-network.de>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 
22 #include "core/BundleFilter.h"
23 #include <ibrcommon/Logger.h>
24 
25 #ifndef FILTER_LOGFILTER_H_
26 #define FILTER_LOGFILTER_H_
27 
28 namespace dtn
29 {
30  namespace core
31  {
32  class LogFilter : public BundleFilter
33  {
34  public:
35  LogFilter(const ibrcommon::LogLevel::Level level, const std::string &msg);
36  LogFilter(const int debug_level, const std::string &msg);
37  virtual ~LogFilter();
38  virtual ACTION evaluate(const FilterContext&) const throw ();
39  virtual ACTION filter(const FilterContext&, dtn::data::Bundle&) const throw ();
40 
41  private:
42  void log(const FilterContext &context) const throw ();
43 
44  const static std::string TAG;
45  const ibrcommon::LogLevel::Level _level;
46  const std::string _msg;
47  const int _debug_level;
48  };
49  } /* namespace core */
50 } /* namespace dtn */
51 
52 #endif /* FILTER_LOGFILTER_H_ */
virtual ACTION filter(const FilterContext &, dtn::data::Bundle &) const
Definition: LogFilter.cpp:95
virtual ACTION evaluate(const FilterContext &) const
Definition: LogFilter.cpp:86
LogFilter(const ibrcommon::LogLevel::Level level, const std::string &msg)
Definition: LogFilter.cpp:35
virtual ~LogFilter()
Definition: LogFilter.cpp:40