MLT  7.28.0
mlt_log.h
Go to the documentation of this file.
1 
22 #ifndef MLT_LOG_H
23 #define MLT_LOG_H
24 
25 #include <stdarg.h>
26 #include <stdint.h>
27 
28 #define MLT_LOG_QUIET -8
29 
33 #define MLT_LOG_PANIC 0
34 
40 #define MLT_LOG_FATAL 8
41 
46 #define MLT_LOG_ERROR 16
47 
52 #define MLT_LOG_WARNING 24
53 
54 #define MLT_LOG_INFO 32
55 #define MLT_LOG_VERBOSE 40
56 #define MLT_LOG_TIMINGS 44
57 
61 #define MLT_LOG_DEBUG 48
62 
76 #ifdef __GNUC__
77 void mlt_log(void *service, int level, const char *fmt, ...)
78  __attribute__((__format__(__printf__, 3, 4)));
79 #else
80 void mlt_log(void *service, int level, const char *fmt, ...);
81 #endif
82 
83 #define mlt_log_panic(service, format, args...) mlt_log((service), MLT_LOG_PANIC, (format), ##args)
84 #define mlt_log_fatal(service, format, args...) mlt_log((service), MLT_LOG_FATAL, (format), ##args)
85 #define mlt_log_error(service, format, args...) mlt_log((service), MLT_LOG_ERROR, (format), ##args)
86 #define mlt_log_warning(service, format, args...) \
87  mlt_log((service), MLT_LOG_WARNING, (format), ##args)
88 #define mlt_log_info(service, format, args...) mlt_log((service), MLT_LOG_INFO, (format), ##args)
89 #define mlt_log_verbose(service, format, args...) \
90  mlt_log((service), MLT_LOG_VERBOSE, (format), ##args)
91 #define mlt_log_timings(service, format, args...) \
92  mlt_log((service), MLT_LOG_TIMINGS, (format), ##args)
93 #define mlt_log_debug(service, format, args...) mlt_log((service), MLT_LOG_DEBUG, (format), ##args)
94 
95 void mlt_vlog(void *service, int level, const char *fmt, va_list);
96 int mlt_log_get_level(void);
97 void mlt_log_set_level(int);
98 void mlt_log_set_callback(void (*)(void *, int, const char *, va_list));
99 
100 #define mlt_log_timings_begin() \
101  { \
102  int64_t _mlt_log_timings_begin = mlt_log_timings_now(), _mlt_log_timings_end;
103 
104 #define mlt_log_timings_end(service, msg) \
105  _mlt_log_timings_end = mlt_log_timings_now(); \
106  mlt_log_timings(service, \
107  "%s:%d: T(%s)=%" PRId64 " us\n", \
108  __FILE__, \
109  __LINE__, \
110  msg, \
111  _mlt_log_timings_end - _mlt_log_timings_begin); \
112  }
113 
114 int64_t mlt_log_timings_now(void);
115 
116 #endif /* MLT_LOG_H */
void mlt_log(void *service, int level, const char *fmt,...)
Send the specified message to the log if the level is less than or equal to the current logging level...
int64_t mlt_log_timings_now(void)
Definition: mlt_log.c:107
void mlt_log_set_level(int)
Definition: mlt_log.c:97
void mlt_vlog(void *service, int level, const char *fmt, va_list)
Definition: mlt_log.c:86
void mlt_log_set_callback(void(*)(void *, int, const char *, va_list))
Definition: mlt_log.c:102
int mlt_log_get_level(void)
Definition: mlt_log.c:92
struct __attribute__((aligned(16)))
private to mlt_pool_s, for tracking items to release
Definition: mlt_pool.c:98