- Aldebaran documentation |
- C++ Libraries |
- index

libqicore-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
loglistener.hpp
Go to the documentation of this file.
1 /*
2 ** Author(s):
3 ** - Herve Cuche <hcuche@aldebaran-robotics.com>
4 ** - Matthieu Nottale <mnottale@aldebaran-robotics.com>
5 **
6 ** Copyright (C) 2013 Aldebaran Robotics
7 */
8
9 #ifndef LOGLISTENER_HPP_
10 #define LOGLISTENER_HPP_
11
12 #include <string>
13
14 #include <qi/log.hpp>
15
16 #include <qicore/api.hpp>
17 #include <qicore/logmanager.hpp>
18 #include <qicore/logmessage.hpp>
19
20 #include <qi/signal.hpp>
21 #include <qi/property.hpp>
22 #include <qi/anyobject.hpp>
23
24 namespace qi
25 {
26 class QICORE_API LogListener
27 {
28 protected:
29 template< class... T >
30 using PropertyType = qi::UnsafeProperty<T...>;
31
32 LogListener() = default;
33 LogListener(PropertyType<qi::LogLevel>::Getter get,
34 PropertyType<qi::LogLevel>::Setter set,
35 boost::function<Future<void>(bool)> func = {})
36 : logLevel(get, set)
37 , onLogMessagesWithBacklog(func)
38 {
39 }
40
41 public:
42 virtual ~LogListener() = default;
43
44 virtual void setLevel(qi::LogLevel level) = 0;
45 virtual void addFilter(const std::string& filter, qi::LogLevel level) = 0;
46
48 virtual void clearFilters() = 0;
49
50 public:
51 PropertyType<qi::LogLevel> logLevel;
52 qi::Signal<qi::LogMessage> onLogMessage;
53 qi::Signal<std::vector<qi::LogMessage> > onLogMessages;
54 qi::Signal<std::vector<qi::LogMessage> > onLogMessagesWithBacklog;
55 };
56
57 using LogListenerPtr = qi::Object<LogListener>;
58 } // !qi
59
60 namespace qi
61 {
62 namespace detail
63 {
64 template <>
65 struct QICORE_API ForceProxyInclusion<qi::LogListener>
66 {
67 bool dummyCall();
68 };
69 }
70 }
71
72 #endif // !LOGLISTENER_HPP_
qi::LogListener::onLogMessages
qi::Signal< std::vector< qi::LogMessage > > onLogMessages
Definition: loglistener.hpp:53
logmessage.hpp
qi::LogListener::onLogMessagesWithBacklog
qi::Signal< std::vector< qi::LogMessage > > onLogMessagesWithBacklog
Definition: loglistener.hpp:54
api.hpp
qi::LogListener::onLogMessage
qi::Signal< qi::LogMessage > onLogMessage
Definition: loglistener.hpp:52
qi::LogListener::PropertyType
qi::UnsafeProperty< T...> PropertyType
Definition: loglistener.hpp:30
qi::LogListenerPtr
qi::Object< LogListener > LogListenerPtr
Definition: loglistener.hpp:57
qi::LogListener::logLevel
PropertyType< qi::LogLevel > logLevel
Definition: loglistener.hpp:51
qi::LogListener::LogListener
LogListener(PropertyType< qi::LogLevel >::Getter get, PropertyType< qi::LogLevel >::Setter set, boost::function< Future< void >(bool)> func={})
Definition: loglistener.hpp:33
qi::LogListener
Definition: loglistener.hpp:26
logmanager.hpp
QICORE_API
#define QICORE_API
Definition: api.hpp:14