28 lines
1.1 KiB
C
Executable File
28 lines
1.1 KiB
C
Executable File
#ifndef _ULOG_API_H
|
|
#define _ULOG_API_H
|
|
|
|
#include <syslog.h>
|
|
|
|
#include "common_types.h"
|
|
|
|
#define MAX_MODULE_NAME_SZ 16
|
|
|
|
typedef struct _ulog {
|
|
char module_name[MAX_MODULE_NAME_SZ+1];
|
|
} ulog_t;
|
|
|
|
ulog_t *ulog_init(const char *module_name, u8 is_print);
|
|
void ulog_close(ulog_t *log);
|
|
void ulog_record(const ulog_t *log, int level, const char *fmt, ...);
|
|
|
|
#define ULOG_DEBUG(log, fmt, ...) ulog_record(log, LOG_DEBUG, fmt, ##__VA_ARGS__)
|
|
#define ULOG_INFO(log, fmt, ...) ulog_record(log, LOG_INFO, fmt, ##__VA_ARGS__)
|
|
#define ULOG_NOTICE(log, fmt, ...) ulog_record(log, LOG_NOTICE, fmt, ##__VA_ARGS__)
|
|
#define ULOG_WARNING(log, fmt, ...) ulog_record(log, LOG_WARNING, fmt, ##__VA_ARGS__)
|
|
#define ULOG_ERR(log, fmt, ...) ulog_record(log, LOG_ERR, fmt, ##__VA_ARGS__)
|
|
#define ULOG_CRIT(log, fmt, ...) ulog_record(log, LOG_CRIT, fmt, ##__VA_ARGS__)
|
|
#define ULOG_ALERT(log, fmt, ...) ulog_record(log, LOG_ALERT, fmt, ##__VA_ARGS__)
|
|
#define ULOG_EMERG(log, fmt, ...) ulog_record(log, LOG_EMERG, fmt, ##__VA_ARGS__)
|
|
|
|
#endif
|