From abcbc173970e73317320e0e29873c4e2de3c16d6 Mon Sep 17 00:00:00 2001 From: abqjln <56203715+abqjln@users.noreply.github.com> Date: Wed, 13 Nov 2024 05:43:07 -0700 Subject: [PATCH 1/3] TAG; type consistent with otherst; elim unused #define --- binc/agent.c | 2 +- binc/logger.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/binc/agent.c b/binc/agent.c index 9059d53..ee7d35a 100644 --- a/binc/agent.c +++ b/binc/agent.c @@ -30,7 +30,7 @@ #include #include -#define TAG "Agent" +static const char *const TAG = "Agent"; struct binc_agent { char *path; // Owned diff --git a/binc/logger.c b/binc/logger.c index dd29878..bf12a76 100644 --- a/binc/logger.c +++ b/binc/logger.c @@ -27,7 +27,6 @@ #include #include -#define TAG "Logger" #define BUFFER_SIZE 1024 #define MAX_FILE_SIZE 1024 * 64 #define MAX_LOGS 5 From 85470661e68514cbc77fa4bcc36e80bbe79ec775 Mon Sep 17 00:00:00 2001 From: abqjln <56203715+abqjln@users.noreply.github.com> Date: Sun, 8 Dec 2024 05:49:40 -0700 Subject: [PATCH 2/3] Revert "TAG; type consistent with otherst; elim unused #define" This reverts commit abcbc173970e73317320e0e29873c4e2de3c16d6. --- binc/agent.c | 2 +- binc/logger.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/binc/agent.c b/binc/agent.c index ee7d35a..9059d53 100644 --- a/binc/agent.c +++ b/binc/agent.c @@ -30,7 +30,7 @@ #include #include -static const char *const TAG = "Agent"; +#define TAG "Agent" struct binc_agent { char *path; // Owned diff --git a/binc/logger.c b/binc/logger.c index bf12a76..dd29878 100644 --- a/binc/logger.c +++ b/binc/logger.c @@ -27,6 +27,7 @@ #include #include +#define TAG "Logger" #define BUFFER_SIZE 1024 #define MAX_FILE_SIZE 1024 * 64 #define MAX_LOGS 5 From bba41585563da90d4d2244590dd25192f3d34f9c Mon Sep 17 00:00:00 2001 From: abqjln <56203715+abqjln@users.noreply.github.com> Date: Sun, 8 Dec 2024 06:01:43 -0700 Subject: [PATCH 3/3] add log_get_level --- binc/logger.c | 4 ++++ binc/logger.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/binc/logger.c b/binc/logger.c index dd29878..fefa715 100644 --- a/binc/logger.c +++ b/binc/logger.c @@ -54,6 +54,10 @@ void log_set_level(LogLevel level) { LogSettings.level = level; } +LogLevel log_get_level(void) { + return LogSettings.level; +} + void log_set_handler(LogEventCallback callback) { LogSettings.logCallback = callback; } diff --git a/binc/logger.h b/binc/logger.h index a60e946..223dc6b 100644 --- a/binc/logger.h +++ b/binc/logger.h @@ -43,6 +43,8 @@ void log_log_at_level(LogLevel level, const char* tag, const char *format, ...); void log_set_level(LogLevel level); +LogLevel log_get_level(void); + void log_set_filename(const char* filename, unsigned long max_size, unsigned int max_files); typedef void (*LogEventCallback)(LogLevel level, const char *tag, const char *message);