Switch to LOG macro

This commit is contained in:
Ian Gulliver
2016-03-07 17:02:24 -08:00
parent 602c6f729b
commit b434b67dd8
12 changed files with 75 additions and 51 deletions

View File

@@ -38,6 +38,8 @@ struct receive {
};
static struct list_head receive_head = LIST_HEAD_INIT(receive_head);
static char log_module = 'R';
static void receive_new(int, void *, struct peer *);
static struct flow _receive_flow = {
@@ -91,7 +93,7 @@ static bool receive_autodetect_parse(struct receive *receive, struct packet *pac
for (size_t i = 0; i < NUM_PARSERS; i++) {
if (parsers[i].parse(buf, packet, state)) {
log_write('R', receive->id, "Detected input format: %s", parsers[i].name);
LOG(receive->id, "Detected input format: %s", parsers[i].name);
receive->parser_wrapper = receive_parse_wrapper;
receive->parser = parsers[i].parse;
return true;
@@ -104,7 +106,7 @@ static bool receive_autodetect_parse(struct receive *receive, struct packet *pac
}
static void receive_del(struct receive *receive) {
log_write('R', receive->id, "Connection closed");
LOG(receive->id, "Connection closed");
peer_count_in--;
peer_epoll_del((struct peer *) receive);
assert(!close(receive->peer.fd));
@@ -133,14 +135,14 @@ static void receive_read(struct peer *peer) {
continue;
}
if (++packet.hops > receive_max_hops) {
log_write('R', receive->id, "Packet exceeded hop limit (%u > %u); dropping. You may have a loop in your configuration.", packet.hops, receive_max_hops);
LOG(receive->id, "Packet exceeded hop limit (%u > %u); dropping. You may have a loop in your configuration.", packet.hops, receive_max_hops);
continue;
}
send_write(&packet);
}
if (receive->buf.length == BUF_LEN_MAX) {
log_write('R', receive->id, "Input buffer overrun. This probably means that adsbus doesn't understand the protocol that this source is speaking.");
LOG(receive->id, "Input buffer overrun. This probably means that adsbus doesn't understand the protocol that this source is speaking.");
receive_del(receive);
return;
}
@@ -165,7 +167,7 @@ static void receive_new(int fd, void __attribute__((unused)) *passthrough, struc
peer_epoll_add((struct peer *) receive, EPOLLIN);
log_write('R', receive->id, "New receive connection");
LOG(receive->id, "New receive connection");
}
void receive_init() {