24#include <ecoli/assert.h>
69#define EC_LOG_TYPE_REGISTER(name) \
70 static struct ec_log_type name##_log_type = { \
73 static int ec_log_local_type; \
74 __attribute__((constructor, used)) static void ec_log_register_##name(void) \
76 ec_log_local_type = ec_log_type_register(&name##_log_type); \
77 ec_assert_print(ec_log_local_type >= 0, "cannot register log type.\n"); \
152 __attribute__((format(__printf__, 3, 4)));
184#define EC_LOG(level, args...) ec_log(ec_log_local_type, level, args)
202#define EC_VLOG(level, fmt, ap) ec_vlog(ec_log_local_type, level, fmt, ap)
int(* ec_log_t)(int type, enum ec_log_level level, void *opaque, const char *str)
User log function type.
int ec_log_level_set(enum ec_log_level level)
Set the global log level.
int ec_log_fct_register(ec_log_t usr_log, void *opaque)
Register a user log function.
int ec_log_default_cb(int type, enum ec_log_level level, void *opaque, const char *str)
Default log handler.
int ec_log(int type, enum ec_log_level level, const char *format,...) __attribute__((format(__printf__
Log a formatted string.
ec_log_level
Log levels, from most critical to least critical.
int int ec_vlog(int type, enum ec_log_level level, const char *format, va_list ap)
Log a formatted string.
const char * ec_log_name(int type)
Return the log name associated with the log type identifier.
int ec_log_type_register(struct ec_log_type *type)
Register a named log type.
enum ec_log_level ec_log_level_get(void)
Get the global log level.
@ EC_LOG_EMERG
system is unusable
@ EC_LOG_ALERT
action must be taken immediately
@ EC_LOG_CRIT
critical conditions
@ EC_LOG_INFO
informational
@ EC_LOG_WARNING
warning conditions
@ EC_LOG_NOTICE
normal but significant condition
@ EC_LOG_ERR
error conditions
@ EC_LOG_DEBUG
debug-level messages
A structure describing a log type.
enum ec_log_level level
The log level for this type.
int id
The log identifier.