feat: Add helper to setup logger with null sink

Summary:

Test Plan:
This commit is contained in:
icex2
2024-08-15 13:24:43 +02:00
parent 9c538cccac
commit b031d40d2d
2 changed files with 15 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#include "core/log-sink-file.h"
#include "core/log-sink-list.h"
#include "core/log-sink-mutex.h"
#include "core/log-sink-null.h"
#include "core/log-sink-std.h"
// so we can log data dumps of rs232 streams without crashing
@@ -15,6 +16,18 @@
// 64 kb * 64 = 4 MB for logging total
#define CORE_LOG_BT_EXT_ASYNC_QUEUE_LENGTH 64
void core_log_bt_ext_init_with_null()
{
core_log_sink_t sink;
core_log_sink_null_open(&sink);
// Size doesn't matter (but must be valid)
// logger is entirely disabled
core_log_bt_init(1024, &sink);
core_log_bt_level_set(CORE_LOG_BT_LOG_LEVEL_OFF);
}
void core_log_bt_ext_init_with_stdout()
{
core_log_sink_t sink;

View File

@@ -4,6 +4,8 @@
#include <stdbool.h>
#include <stdint.h>
void core_log_bt_ext_init_with_null();
/**
* Helper to setup the bemanitools log implementation with a stdout sink.
*/