1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#ifndef __LOG_H
#define __LOG_H
#include <stdarg.h>
#include <sys/time.h>
#include "list.h"
#define LOG_MSG 0
#define LOG_ERROR 1
#define LOG_WARN 2
#define LOG_INFO 3
#define LOG_DEBUG 4
#define LOG_CHUNK_SIZE 128
#define LOG_MAX_SIZE 4096
struct ppp_t;
struct triton_context_t;
struct log_msg_t
{
struct list_head entry;
void *lpd;
void *tpd;
struct timeval timestamp;
int level;
struct log_chunk_t *hdr;
struct list_head *chunks;
};
struct log_chunk_t
{
struct list_head entry;
int len;
char msg[0];
};
struct log_target_t
{
struct list_head entry;
void (*log)(struct log_msg_t *, struct ppp_t *ppp);
};
void log_free_msg(struct log_msg_t *msg);
void log_emerg(const char *fmt, ...);
void log_error(const char *fmt,...);
void log_warn(const char *fmt,...);
void log_info(const char *fmt,...);
void log_debug(const char *fmt,...);
void log_msg(const char *fmt,...);
void log_ppp_error(const char *fmt,...);
void log_ppp_warn(const char *fmt,...);
void log_ppp_info(const char *fmt,...);
void log_ppp_debug(const char *fmt,...);
void log_ppp_msg(const char *fmt,...);
void log_switch(struct triton_context_t *ctx, void *arg);
void log_register_target(struct log_target_t *t);
#endif
|