summaryrefslogtreecommitdiff
path: root/proto_io.c
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-12-29 00:20:57 +0300
committerOxore <oxore@protonmail.com>2023-12-29 00:20:57 +0300
commit5f8f5140eb6d7aa204d2565eec29fd7a2a934906 (patch)
treeae156bd1b7e982c8035c5cfa5546b587771232cb /proto_io.c
parent18893127524d87e47a948b9a92d8d8b2ab869852 (diff)
Introduce runtime log level switching
Diffstat (limited to 'proto_io.c')
-rw-r--r--proto_io.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/proto_io.c b/proto_io.c
index a903546..8f1605d 100644
--- a/proto_io.c
+++ b/proto_io.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: Unlicense */
+#include "debug.h"
#include "proto_io.h"
#include <arpa/inet.h>
@@ -39,7 +40,7 @@ int ReceiveFrame(int fd, struct frame *frame)
frame->addr = addr;
frame->port = port;
}
- if (LOG_TRACE) {
+ if (g_log_level >= LOG_LEVEL_TRACE) {
uint8_t const a0 = addr >> 24;
uint8_t const a1 = addr >> 16;
uint8_t const a2 = addr >> 8;
@@ -57,7 +58,7 @@ int SendFrame(int const fd, struct frame const *const frame)
.sin_port = htons(frame->port),
.sin_addr.s_addr = htonl(frame->addr),
};
- if (LOG_TRACE) {
+ if (g_log_level >= LOG_LEVEL_TRACE) {
uint32_t const addr = frame->addr;
uint16_t const port = frame->port;
uint8_t const a0 = addr >> 24;