feature: support outputting stderr and file logs at the same time
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "plugin_manager.h"
|
||||
#include "session_manager.h"
|
||||
|
||||
#define STELLAR_LOG_STATE(format, ...) LOG_STATE("stellar", format, ##__VA_ARGS__)
|
||||
#define STELLAR_LOG_FATAL(format, ...) LOG_FATAL("stellar", format, ##__VA_ARGS__)
|
||||
#define STELLAR_LOG_ERROR(format, ...) LOG_ERROR("stellar", format, ##__VA_ARGS__)
|
||||
#define STELLAR_LOG_DEBUG(format, ...) LOG_DEBUG("stellar", format, ##__VA_ARGS__)
|
||||
|
||||
@@ -210,7 +210,7 @@ static void *work_thread(void *arg)
|
||||
}
|
||||
|
||||
ATOMIC_SET(&thread->is_runing, 1);
|
||||
STELLAR_LOG_STATE("worker thread %d runing", thr_idx);
|
||||
STELLAR_LOG_FATAL("worker thread %d runing", thr_idx);
|
||||
|
||||
while (ATOMIC_READ(&runtime->need_exit) == 0)
|
||||
{
|
||||
@@ -352,7 +352,7 @@ static void *work_thread(void *arg)
|
||||
}
|
||||
|
||||
ATOMIC_SET(&thread->is_runing, 0);
|
||||
STELLAR_LOG_STATE("worker thread %d exit", thr_idx);
|
||||
STELLAR_LOG_FATAL("worker thread %d exit", thr_idx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ static void stellar_thread_join(struct stellar *st)
|
||||
struct stellar_runtime *runtime = &st->runtime;
|
||||
struct stellar_config *config = &st->config;
|
||||
|
||||
STELLAR_LOG_STATE("wait worker thread exit ...");
|
||||
STELLAR_LOG_FATAL("wait worker thread exit ...");
|
||||
for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++)
|
||||
{
|
||||
struct stellar_thread *thread = &runtime->threads[i];
|
||||
@@ -511,10 +511,10 @@ struct stellar *stellar_new(const char *stellar_cfg_file, const char *plugin_cfg
|
||||
STELLAR_LOG_ERROR("unable to init log");
|
||||
goto error_out;
|
||||
}
|
||||
STELLAR_LOG_STATE("start stellar (version: %s)\n %s", version, logo_str);
|
||||
STELLAR_LOG_STATE("stellar config file : %s", st->stellar_cfg_file);
|
||||
STELLAR_LOG_STATE("plugin config file : %s", st->plugin_cfg_file);
|
||||
STELLAR_LOG_STATE("log config file : %s", st->log_cfg_file);
|
||||
STELLAR_LOG_FATAL("start stellar (version: %s)\n %s", version, logo_str);
|
||||
STELLAR_LOG_FATAL("stellar config file : %s", st->stellar_cfg_file);
|
||||
STELLAR_LOG_FATAL("plugin config file : %s", st->plugin_cfg_file);
|
||||
STELLAR_LOG_FATAL("log config file : %s", st->log_cfg_file);
|
||||
|
||||
if (stellar_config_load(config, st->stellar_cfg_file) != 0)
|
||||
{
|
||||
@@ -597,7 +597,7 @@ void stellar_run(struct stellar *st)
|
||||
if (packet_io_isbreak(runtime->packet_io) && all_session_have_freed(runtime, config))
|
||||
{
|
||||
stellar_stat_output(runtime->stat); // flush stat
|
||||
STELLAR_LOG_STATE("all sessions have been released, notify threads to exit");
|
||||
STELLAR_LOG_FATAL("all sessions have been released, notify threads to exit");
|
||||
ATOMIC_SET(&runtime->need_exit, 1);
|
||||
}
|
||||
}
|
||||
@@ -614,7 +614,7 @@ void stellar_free(struct stellar *st)
|
||||
packet_io_free(runtime->packet_io);
|
||||
plugin_manager_exit(runtime->plug_mgr);
|
||||
stellar_stat_free(runtime->stat);
|
||||
STELLAR_LOG_STATE("stellar exit\n");
|
||||
STELLAR_LOG_FATAL("stellar exit\n");
|
||||
log_free();
|
||||
}
|
||||
}
|
||||
@@ -632,7 +632,7 @@ void stellar_reload_log_level(struct stellar *st)
|
||||
{
|
||||
if (st)
|
||||
{
|
||||
log_reload_level(st->log_cfg_file);
|
||||
log_level_reload(st->log_cfg_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user