12 // ÅÓÌÉ true, ÄÏ ÐÒÏÉÚÏÛÌÁ ÏÛÉÂËÁ
15 /*! The simple log implemetation
18 #define DEFAULT_LOG_LEVEL INFO_LEVEL
21 void log_file(const char *f);
24 void log_level(log_level_t level);
25 void log_level(const char *level);
26 void log_date_format(std::string &format);
27 void log_date_format(const char *format);
28 void log_msgbuf_size(unsigned int size);
29 void log_prefix(const char *prefix);
31 void log_(const char *location, const char *buf);
32 void log_(const char *location, log_level_t level, const char *buf);
33 void log(const char *location, const char *fmt, ...);
34 void log(const char *location, log_level_t level, const char *fmt, ...);
36 void shutdown(int retval) __attribute__((noreturn));
38 #define dlog(x...) F::log(__PRETTY_FUNCTION__, INFO_LEVEL, ##x)
41 #define debug(x...) F::log(__PRETTY_FUNCTION__, DEBUG_LEVEL, ##x)
42 #define bug() do { sigsegv_ = true; F::log(__PRETTY_FUNCTION__, FATAL_LEVEL, \
43 "*** Bug detected at %s:%d.", __FILE__, __LINE__); \
44 F::shutdown(-1); } while(0)
45 #define trace_bug() do { sigsegv_ = true; F::log(__PRETTY_FUNCTION__, FATAL_LEVEL, \
46 "*** Bug detected at %s:%d, tracing:", __FILE__, __LINE__); \
47 kill(0, F_TRACE_SIGNAL); \
48 F::shutdown(-1); } while(0)
49 #define exit_on_unimplemented(feature) do { sigsegv_ = true; F::log(__PRETTY_FUNCTION__, FATAL_LEVEL, \
50 "Sorry, feature \'%s\' at %s:%d. in not implemented yet.", feature, __FILE__, __LINE__); \
51 F::shutdown(-1); } while(0)
52 #define unimplemented(feature) do { F::log(__PRETTY_FUNCTION__, WARN_LEVEL, \
53 "Sorry, feature \'%s\' at %s:%d. in not implemented yet.", feature, __FILE__, __LINE__); \
55 #define bug_on(condition) do { if (condition) bug(); } while(0)
56 #define trace_bug_on(condition) do { if (condition) bug(); } while(0)
58 #define debug(x...) do { } while (0)
59 #define bug() do { } while (0)
60 #define trace_bug() do { } while (0)
61 #define unimplemented(x) do { } while (0)
62 #define exit_on_unimplemented(x) do { } while (0)
63 #define bug_on(condition) do { } while (0)
64 #define trace_bug_on(condition) do { } while (0)