mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-08-20 15:34:02 -05:00
feat: Use async logger in launcher
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#define LOG_MODULE "bootstrap"
|
||||
|
||||
#include "core/log-bt.h"
|
||||
#include "core/log-sink-async.h"
|
||||
#include "core/log-sink-file.h"
|
||||
#include "core/log-sink-list.h"
|
||||
#include "core/log-sink-null.h"
|
||||
@@ -104,6 +105,7 @@ void bootstrap_log_init(const struct bootstrap_log_config *config)
|
||||
{
|
||||
core_log_sink_t sinks[2];
|
||||
core_log_sink_t sink_composed;
|
||||
core_log_sink_t sink_async;
|
||||
enum core_log_bt_log_level level;
|
||||
|
||||
log_assert(config);
|
||||
@@ -133,7 +135,12 @@ void bootstrap_log_init(const struct bootstrap_log_config *config)
|
||||
core_log_sink_null_open(&sink_composed);
|
||||
}
|
||||
|
||||
core_log_bt_reinit(&sink_composed);
|
||||
// TODO have configurable parameters for these
|
||||
// TODO Allow for configuration of async logger on/off, default on
|
||||
core_log_sink_async_open(64 * 1024, 64, CORE_LOG_SINK_ASYNC_OVERFLOW_POLICY_DISCARD_NEW, &sink_composed, &sink_async);
|
||||
|
||||
// TODO have configurable parameters for these
|
||||
core_log_bt_reinit(64 * 1024, &sink_async);
|
||||
|
||||
level = _bootstrap_log_map_level(config->level);
|
||||
core_log_bt_level_set(level);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "avs-ext/property-node.h"
|
||||
#include "avs-ext/property.h"
|
||||
|
||||
#include "core/boot.h"
|
||||
#include "core/config-property-node.h"
|
||||
#include "core/log-bt-ext.h"
|
||||
#include "core/log-bt.h"
|
||||
@@ -68,19 +69,12 @@ static void _launcher_log_header()
|
||||
void _launcher_log_init(
|
||||
const char *log_file_path, enum core_log_bt_log_level level)
|
||||
{
|
||||
core_log_sink_t sinks[2];
|
||||
core_log_sink_t sink_composed;
|
||||
|
||||
if (log_file_path) {
|
||||
core_log_sink_std_out_open(true, &sinks[0]);
|
||||
core_log_sink_file_open(log_file_path, false, true, 10, &sinks[1]);
|
||||
core_log_sink_list_open(sinks, 2, &sink_composed);
|
||||
core_log_bt_ext_init_async_with_stderr_and_file(log_file_path, false, true, 10);
|
||||
} else {
|
||||
core_log_sink_std_out_open(true, &sink_composed);
|
||||
core_log_bt_ext_init_async_with_stderr();
|
||||
}
|
||||
|
||||
core_log_bt_init(&sink_composed);
|
||||
|
||||
core_log_bt_core_api_set();
|
||||
|
||||
core_log_bt_level_set(level);
|
||||
@@ -411,13 +405,13 @@ void _launcher_init(
|
||||
log_assert(bootstrap_config);
|
||||
log_assert(ea3_ident_config);
|
||||
|
||||
core_thread_crt_core_api_set();
|
||||
|
||||
// Early logging pre AVS setup depend entirely on command args
|
||||
// We don't even have the bootstrap configuration loaded at this point
|
||||
_launcher_log_init(options->log.file_path, options->log.level);
|
||||
_launcher_log_header();
|
||||
|
||||
core_thread_crt_core_api_set();
|
||||
|
||||
// TODO make this configurable, e.g. command line args/env vars?
|
||||
core_property_trace_log_enable(true);
|
||||
core_property_node_trace_log_enable(true);
|
||||
|
||||
Reference in New Issue
Block a user