3 * Copyright (C) 2007, Harbour, All rights reserved.
10 #include <sys/types.h>
16 // ÅÓÌÉ true, ÄÏ ÐÒÏÉÚÏÛÌÁ ÏÛÉÂËÁ
19 /*! The simple log implemetation
22 #define DEFAULT_LOG_LEVEL INFO_LEVEL
25 void log_file(const char *f);
28 void log_level(log_level_t level);
29 void log_level(const char *level);
30 void log_date_format(std::string &format);
31 void log_date_format(const char *format);
32 void log_msgbuf_size(unsigned int size);
33 void log_prefix(const char *prefix);
35 void log_(const char *location, const char *buf);
36 void log_(const char *location, log_level_t level, const char *buf);
37 void log(const char *location, const char *fmt, ...);
38 void log(const char *location, log_level_t level, const char *fmt, ...);
40 void shutdown(int retval) __attribute__((noreturn));
42 #define dlog(x...) F::log(__PRETTY_FUNCTION__, INFO_LEVEL, ##x)
45 #define debug(x...) F::log(__PRETTY_FUNCTION__, DEBUG_LEVEL, ##x)
46 #define bug() do { sigsegv_ = true; F::log(__PRETTY_FUNCTION__, FATAL_LEVEL, \
47 "*** Bug detected at %s:%d.", __FILE__, __LINE__); \
48 F::shutdown(-1); } while(0)
49 #define trace_bug() do { sigsegv_ = true; F::log(__PRETTY_FUNCTION__, FATAL_LEVEL, \
50 "*** Bug detected at %s:%d, tracing:", __FILE__, __LINE__); \
51 kill(0, F_TRACE_SIGNAL); \
52 F::shutdown(-1); } while(0)
53 #define exit_on_unimplemented(feature) do { sigsegv_ = true; F::log(__PRETTY_FUNCTION__, FATAL_LEVEL, \
54 "Sorry, feature \'%s\' at %s:%d. in not implemented yet.", feature, __FILE__, __LINE__); \
55 F::shutdown(-1); } while(0)
56 #define unimplemented(feature) do { F::log(__PRETTY_FUNCTION__, WARN_LEVEL, \
57 "Sorry, feature \'%s\' at %s:%d. in not implemented yet.", feature, __FILE__, __LINE__); \
59 #define bug_on(condition) do { if (condition) bug(); } while(0)
60 #define trace_bug_on(condition) do { if (condition) bug(); } while(0)
62 #define debug(x...) do { } while (0)
63 #define bug() do { } while (0)
64 #define trace_bug() do { } while (0)
65 #define unimplemented(x) do { } while (0)
66 #define exit_on_unimplemented(x) do { } while (0)
67 #define bug_on(condition) do { } while (0)
68 #define trace_bug_on(condition) do { } while (0)