33void asrt_log(
enum asrt_log_level level,
char const* module,
char const* fmt, ... );
36#define ASRT_DBG_LOG( module, ... ) asrt_log( ASRT_LOG_DEBUG, module, __VA_ARGS__ )
39#define ASRT_INF_LOG( module, ... ) asrt_log( ASRT_LOG_INFO, module, __VA_ARGS__ )
42#define ASRT_ERR_LOG( module, ... ) asrt_log( ASRT_LOG_ERROR, module, __VA_ARGS__ )
46#define ASRT_DEFINE_GPOS_LOG_IMPL \
48 enum asrt_log_level level, char const* module, char const* fmt, va_list args ) \
51 char const* level_str = "UNK"; \
53 case ASRT_LOG_DEBUG: \
54 level_str = "\033[36mDEBUG\033[0m"; \
57 level_str = "\033[32mINFO\033[0m"; \
59 case ASRT_LOG_ERROR: \
60 level_str = "\033[31mERROR\033[0m"; \
67 time_t t = time( NULL ); \
69 localtime_r( &t, &tm ); \
70 strftime( timebuf, sizeof( timebuf ), "%Y%m%d %H%M%S", &tm ); \
72 fprintf( stderr, "%s %s %s :: ", timebuf, module ? module : "-", level_str ); \
73 vfprintf( stderr, fmt, args ); \
74 fprintf( stderr, "\n" ); \
79#define ASRT_DEFINE_GPOS_LOG() \
80 ASRT_DEFINE_GPOS_LOG_IMPL \
81 void asrt_log( enum asrt_log_level level, char const* module, char const* fmt, ... ) \
84 va_start( args, fmt ); \
85 asrt_log_impl( level, module, fmt, args ); \