feat(module manager API): add stellar_module_manager_get_logger

This commit is contained in:
yangwei
2024-09-29 14:23:26 +08:00
parent 2ea8d96c5c
commit d9d9b4728d
6 changed files with 19 additions and 13 deletions

View File

@@ -13,16 +13,14 @@
*******************************************/
#include "toml/toml.h"
#include <fcntl.h>
#include <unistd.h>
struct stellar_module_manager *stellar_module_manager_new(const char *module_spec_toml_path, int max_thread_num, struct mq_schema *mq_schema)
struct stellar_module_manager *stellar_module_manager_new(const char *module_spec_toml_path, int max_thread_num, struct mq_schema *mq_schema, struct logger *logger)
{
struct stellar_module_manager *mod_mgr = CALLOC(struct stellar_module_manager, 1);
mod_mgr->schema.max_thread_num=max_thread_num;
mod_mgr->schema.mq_schema=mq_schema;
mod_mgr->schema.logger=logger;
if(module_spec_toml_path==NULL)return mod_mgr;
FILE *fp = fopen(module_spec_toml_path, "r");
if (fp == NULL)return mod_mgr;
@@ -133,6 +131,12 @@ struct mq_schema *stellar_module_manager_get_mq_schema(struct stellar_module_man
return mod_mgr->schema.mq_schema;
}
struct logger *stellar_module_manager_get_logger(struct stellar_module_manager *mod_mgr)
{
if(mod_mgr==NULL)return NULL;
return mod_mgr->schema.logger;
}
const char *stellar_module_manager_get_toml_path(struct stellar_module_manager *mod_mgr)
{
if(mod_mgr==NULL)return NULL;