6 #include <Poco/Exception.h>
7 #include <Poco/Message.h>
23 Loggable(
const std::type_info &info);
26 static Poco::Logger &forMethod(
const char *name);
27 static Poco::Logger &forClass(
const ClassInfo &info);
28 static Poco::Logger &forClass(
const std::type_info &info);
31 static Poco::Logger &forInstance(
const T *i)
33 return forClass(
typeid(*i));
36 static void configureSimple(
37 Poco::Logger &logger,
const std::string &level);
39 static void logException(
41 const Poco::Message::Priority priority,
42 const Poco::Exception &e,
47 void setupLogger(Poco::Logger *logger = 0)
const;
49 Poco::Logger &logger()
const
56 const std::string m_name;
57 mutable Poco::Logger *m_logger;
62 #define BEEEON_CATCH_CHAIN(logger) \
63 catch (const Poco::Exception &e) { \
64 Loggable::logException((logger), \
65 Poco::Message::PRIO_ERROR, e, __FILE__, __LINE__); \
67 catch (const std::exception &e) { \
68 (logger).critical(e.what(), __FILE__, __LINE__); \
70 catch (const char *m) { \
71 (logger).fatal(m, __FILE__, __LINE__); \
74 (logger).fatal("unknown error occured", __FILE__, __LINE__); \
77 #define BEEEON_CATCH_CHAIN_MESSAGE(logger, message) \
78 catch (const Poco::Exception &e) { \
79 Loggable::logException((logger), \
80 Poco::Message::PRIO_ERROR, e, __FILE__, __LINE__); \
81 (logger).error(message, __FILE__, __LINE__); \
83 catch (const std::exception &e) { \
84 (logger).critical(e.what(), __FILE__, __LINE__); \
85 (logger).critical(message, __FILE__, __LINE__); \
87 catch (const char *m) { \
88 (logger).fatal(m, __FILE__, __LINE__); \
89 (logger).fatal(message, __FILE__, __LINE__); \
92 (logger).fatal("unknown error occured", __FILE__, __LINE__); \
93 (logger).fatal(message, __FILE__, __LINE__); \
96 #define BEEEON_CATCH_CHAIN_RETHROW(logger) \
97 catch (const Poco::Exception &e) { \
98 Loggable::logException((logger), \
99 Poco::Message::PRIO_ERROR, e, __FILE__, __LINE__); \
102 catch (const std::exception &e) { \
103 (logger).critical(e.what(), __FILE__, __LINE__); \
104 throw Poco::RuntimeException(e.what()); \
106 catch (const char *m) { \
107 (logger).fatal(m, __FILE__, __LINE__); \
108 throw Poco::RuntimeException(m); \
111 (logger).fatal("unknown error occured", __FILE__, __LINE__); \
112 throw Poco::RuntimeException("unknown error"); \
115 #define BEEEON_CATCH_CHAIN_ACTION(logger, action) \
116 catch (const Poco::Exception &e) { \
117 Loggable::logException((logger), \
118 Poco::Message::PRIO_ERROR, e, __FILE__, __LINE__); \
121 catch (const std::exception &e) { \
122 (logger).critical(e.what(), __FILE__, __LINE__); \
125 catch (const char *m) { \
126 (logger).fatal(m, __FILE__, __LINE__); \
130 (logger).fatal("unknown error occured", __FILE__, __LINE__); \
134 #define BEEEON_CATCH_CHAIN_ACTION_RETHROW(logger, action) \
135 catch (const Poco::Exception &e) { \
136 Loggable::logException((logger), \
137 Poco::Message::PRIO_ERROR, e, __FILE__, __LINE__); \
141 catch (const std::exception &e) { \
142 (logger).critical(e.what(), __FILE__, __LINE__); \
144 throw Poco::RuntimeException(e.what()); \
146 catch (const char *m) { \
147 (logger).fatal(m, __FILE__, __LINE__); \
149 throw Poco::RuntimeException(m); \
152 (logger).fatal("unknown error occured", __FILE__, __LINE__); \
154 throw Poco::RuntimeException("unknown error"); \
Definition: ClassInfo.h:9
Definition: Loggable.h:19