tfe 支持 zlog
This commit is contained in:
@@ -22,10 +22,6 @@ struct http_plugin
|
||||
struct event * gc_event_hs_private[TFE_THREAD_MAX];
|
||||
/* ACCESS LOGGER */
|
||||
void * logger;
|
||||
/* LOGLEVE */
|
||||
int log_level;
|
||||
/* LOGFILE */
|
||||
char log_file[TFE_STRING_MAX];
|
||||
};
|
||||
|
||||
extern struct http_plugin * g_http_plugin;
|
||||
|
||||
@@ -55,21 +55,11 @@ 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
|
||||
@@ -99,8 +89,8 @@ 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(plugin_ctx->log_file, plugin_ctx->log_level);
|
||||
assert(plugin_ctx->logger != NULL);
|
||||
plugin_ctx->logger = MESA_create_runtime_log_handle("http", RLOG_LV_DEBUG);
|
||||
assert(plugin_ctx->logger != NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
#include <http2_stream.h>
|
||||
|
||||
typedef struct RTLogInit2Data_ {
|
||||
int run_log_level;
|
||||
|
||||
char run_log_path[256];
|
||||
|
||||
void *handle;
|
||||
} RTLogInit2Data;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <http2_common.h>
|
||||
|
||||
RTLogInit2Data logging_sc_lid = {
|
||||
.run_log_level = 1,
|
||||
|
||||
};
|
||||
|
||||
RTLogInit2Data *logger()
|
||||
|
||||
@@ -46,13 +46,7 @@ struct event_timer_ctx
|
||||
void load_logging_conf(const char *config)
|
||||
{
|
||||
RTLogInit2Data *logging_sc_lid = logger();
|
||||
|
||||
MESA_load_profile_int_def(config, (const char *)"http",(const char *)"loglevel",
|
||||
&logging_sc_lid->run_log_level, 10);
|
||||
MESA_load_profile_string_def(config, (const char *)"http",(const char *)"logfile",
|
||||
logging_sc_lid->run_log_path, 128, "log/http2.log");
|
||||
|
||||
logging_sc_lid->handle = MESA_create_runtime_log_handle(logging_sc_lid->run_log_path, logging_sc_lid->run_log_level);
|
||||
logging_sc_lid->handle = MESA_create_runtime_log_handle("http2", RLOG_LV_DEBUG);
|
||||
if(logging_sc_lid->handle == NULL){
|
||||
TFE_LOG_ERROR(logging_sc_lid->handle, "Create log runtime_log_handle error, init failed!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user