From 5f8f5140eb6d7aa204d2565eec29fd7a2a934906 Mon Sep 17 00:00:00 2001 From: Oxore Date: Fri, 29 Dec 2023 00:20:57 +0300 Subject: Introduce runtime log level switching --- proto_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'proto_io.c') 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 @@ -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; -- cgit v1.2.3