2016-11-07 11:29:49 +00:00
|
|
|
#ifndef OD_LOG_H_
|
|
|
|
#define OD_LOG_H_
|
|
|
|
|
|
|
|
/*
|
2016-11-08 11:18:58 +00:00
|
|
|
* odissey.
|
|
|
|
*
|
|
|
|
* PostgreSQL connection pooler and request router.
|
2016-11-07 11:29:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct odlog_t odlog_t;
|
|
|
|
|
|
|
|
struct odlog_t {
|
|
|
|
int pid;
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
|
|
|
int od_loginit(odlog_t*);
|
|
|
|
int od_logopen(odlog_t*, char*);
|
|
|
|
int od_logclose(odlog_t*);
|
2016-11-15 11:38:31 +00:00
|
|
|
int od_logv(odlog_t*, char*, char*, va_list);
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
od_log(odlog_t *l, char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
|
|
int rc = od_logv(l, NULL, fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
od_debug(odlog_t *l, char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
|
|
int rc = od_logv(l, "debug: ", fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
od_error(odlog_t *l, char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
|
|
int rc = od_logv(l, "error: ", fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
return rc;
|
|
|
|
}
|
2016-11-07 11:29:49 +00:00
|
|
|
|
|
|
|
#endif
|