增加HTTP日志等级配置功能

This commit is contained in:
luqiuwen
2018-12-13 23:40:36 +06:00
parent 94242de81c
commit 8c93f7203d
4 changed files with 17 additions and 2 deletions

View File

@@ -55,11 +55,21 @@ static void http_plugin_session_gc_cb(evutil_socket_t fd, short what, void * arg
}
}
#include <MESA/MESA_prof_load.h>
int http_plugin_config(struct tfe_proxy * proxy, struct http_plugin * ht_handle)
{
MESA_load_profile_int_def("conf/tfe/tfe.conf", "http", "loglevel", &ht_handle->log_level, RLOG_LV_INFO);
MESA_load_profile_string_def("conf/tfe/tfe.conf", "http", "logfile", ht_handle->log_file, sizeof(ht_handle->log_file), "log/http.log");
return 0;
}
int http_plugin_init(struct tfe_proxy * proxy)
{
unsigned int nr_work_thread = tfe_proxy_get_work_thread_count();
struct http_plugin * plugin_ctx = g_http_plugin;
http_plugin_config(proxy, plugin_ctx);
for (unsigned int thread_id = 0; thread_id < nr_work_thread; thread_id++)
{
#ifndef NDEBUG
@@ -89,7 +99,7 @@ int http_plugin_init(struct tfe_proxy * proxy)
plugin_ctx->gc_event_hs_private[thread_id] = gc_event;
}
plugin_ctx->logger = MESA_create_runtime_log_handle("log/http.log", RLOG_LV_INFO);
plugin_ctx->logger = MESA_create_runtime_log_handle(plugin_ctx->log_file, plugin_ctx->log_level);
assert(plugin_ctx->logger != NULL);
return 0;