From 5d5af62d63c331245a1cb41433fabc0ac25754b6 Mon Sep 17 00:00:00 2001
From: sanine <sanine.not@pm.me>
Date: Tue, 14 Jun 2022 20:24:14 -0500
Subject: add honey_set_log_level

---
 src/logging/logging.c      | 6 ++++++
 src/logging/logging.h      | 1 +
 src/logging/logging.test.c | 1 +
 3 files changed, 8 insertions(+)

(limited to 'src/logging')

diff --git a/src/logging/logging.c b/src/logging/logging.c
index 4f717cb..cb720a4 100644
--- a/src/logging/logging.c
+++ b/src/logging/logging.c
@@ -3,6 +3,12 @@
 
 int _honey_log_level = HONEY_WARN;
 
+void honey_set_log_level(int level)
+{
+	_honey_log_level = level;
+}
+
+
 void honey_log(int level, const char *fmt, ...) {
 	//if (level > _honey_log_level) return;
 
diff --git a/src/logging/logging.h b/src/logging/logging.h
index 2618d2b..ad63a9c 100644
--- a/src/logging/logging.h
+++ b/src/logging/logging.h
@@ -10,6 +10,7 @@
 
 extern int _honey_log_level;
 
+void honey_set_log_level(int level);
 void honey_log(int level, const char *fmt, ...);
 
 #define honey_fatal(...) honey_log(HONEY_FATAL, "[FATAL] "__VA_ARGS__)
diff --git a/src/logging/logging.test.c b/src/logging/logging.test.c
index e227381..cc6a316 100644
--- a/src/logging/logging.test.c
+++ b/src/logging/logging.test.c
@@ -93,6 +93,7 @@ void test_log_fatal_succeeds()
 	clean_mock(&vfprintf_mock_data);
 	vfprintf_mock_data = lily_mock_create();
 
+	honey_set_log_level(HONEY_FATAL);
 	honey_fatal("some message");
 	lily_assert_int_equal(vfprintf_mock_data->n_calls, 1);
 
-- 
cgit v1.2.1