1
1
mirror of https://github.com/tstack/lnav.git synced 2024-09-11 13:05:51 +03:00

[debt] even more mem leaks

Defect Number:
    Reviewed By:
   Testing Done:
This commit is contained in:
Timothy Stack 2020-12-01 11:27:03 -08:00
parent 21f127cb56
commit 19e0624ab6
22 changed files with 86 additions and 91 deletions

View File

@ -50,7 +50,7 @@ void all_logs_vtab::extract(std::shared_ptr<logfile> lf, uint64_t line_number,
shared_buffer_ref &line,
std::vector<logline_value> &values)
{
auto *format = lf->get_format();
auto format = lf->get_format();
values.emplace_back(this->alv_value_name, format->get_name(), 0);
std::vector<logline_value> sub_values;

View File

@ -212,7 +212,7 @@ void field_overlay_source::build_field_lines(const listview_curses &lv)
content_line_t cl = lss.at(lv.get_top());
std::shared_ptr<logfile> file = lss.find(cl);
auto ll = file->begin() + cl;
log_format *format = file->get_format();
auto format = file->get_format();
bool display = false;
if (ll->is_time_skewed()) {
@ -357,7 +357,7 @@ void field_overlay_source::build_field_lines(const listview_curses &lv)
this->fos_unknown_key_size, (int)colname.length());
}
log_format *lf = this->fos_log_helper.ldh_file->get_format();
auto lf = this->fos_log_helper.ldh_file->get_format();
if (!lf->get_pattern_regex(cl).empty()) {
attr_line_t pattern_al;
std::string &pattern_str = pattern_al.get_string();

View File

@ -71,7 +71,7 @@ CREATE TABLE lnav_file (
auto lf = *vc.iter;
const struct stat &st = lf->get_stat();
const string &name = lf->get_filename();
log_format *format = lf->get_format();
auto format = lf->get_format();
const char *format_name =
format != nullptr ? format->get_name().get() : nullptr;

View File

@ -82,7 +82,7 @@ public:
content_line_t cl = this->lh_sub_source.at(this->lh_current_line);
std::shared_ptr<logfile> lf = this->lh_sub_source.find(cl);
auto ll = lf->begin() + cl;
log_format *format = lf->get_format();
auto format = lf->get_format();
lf->read_full_message(ll, this->lh_msg_buffer);
format->annotate(cl,
this->lh_msg_buffer,

View File

@ -482,7 +482,7 @@ public:
log_info("promoting text file to log file: %s (%s)",
lf->get_filename().c_str(),
lf->get_content_id().c_str());
auto *format = lf->get_format();
auto format = lf->get_format();
if (format->lf_is_self_describing) {
auto vt = format->get_vtab_impl();
@ -2468,8 +2468,8 @@ int main(int argc, char *argv[])
rebuild_result = lf->rebuild_index();
} while (rebuild_result == logfile::RR_NEW_LINES ||
rebuild_result == logfile::RR_NEW_ORDER);
log_format *fmt = lf->get_format();
if (fmt == NULL) {
auto fmt = lf->get_format();
if (fmt == nullptr) {
fprintf(stderr, "error:%s:no format found for file\n",
lf->get_filename().c_str());
retval = EXIT_FAILURE;

View File

@ -993,7 +993,7 @@ static Result<string, string> com_pipe_to(exec_context &ec, string cmdline, vect
char tmp_str[64];
ldh.parse_line(ec.ec_top_line, true);
log_format *format = ldh.ldh_file->get_format();
auto format = ldh.ldh_file->get_format();
set<string> source_path = format->get_source_path();
path_v.insert(path_v.end(),
source_path.begin(),
@ -3106,7 +3106,7 @@ static Result<string, string> com_toggle_field(exec_context &ec, string cmdline,
for (int lpc = 1; lpc < (int)args.size(); lpc++) {
intern_string_t name;
log_format *format = nullptr;
std::shared_ptr<log_format> format;
size_t dot;
if ((dot = args[lpc].find('.')) != string::npos) {
@ -3705,7 +3705,7 @@ public:
continue;
}
log_format *format = lf->get_format();
auto format = lf->get_format();
const logline_value_stats *stats = format->stats_for_value(this->lsvs_colname);
if (stats == NULL) {
@ -3773,7 +3773,7 @@ public:
content_line_t cl = lss.at(curr_line);
std::shared_ptr<logfile> lf = lss.find(cl);
auto ll = lf->begin() + cl;
log_format *format = lf->get_format();
auto format = lf->get_format();
shared_buffer_ref sbr;
if (ll->is_continued()) {
@ -3825,8 +3825,8 @@ public:
for (vis_line_t curr_line = begin_line; curr_line < end_line; ++curr_line) {
content_line_t cl = lss.at(curr_line);
std::shared_ptr<logfile> lf = lss.find(cl);
logfile::iterator ll = lf->begin() + cl;
log_format *format = lf->get_format();
auto ll = lf->begin() + cl;
auto format = lf->get_format();
shared_buffer_ref sbr;
if (ll->is_continued()) {

View File

@ -42,7 +42,7 @@ static string execute_action(log_data_helper &ldh,
std::map<string, log_format::action_def>::const_iterator iter;
logline_value &lv = ldh.ldh_line_values[value_index];
shared_ptr<logfile> lf = ldh.ldh_file;
const log_format *format = lf->get_format();
const auto format = lf->get_format();
pid_t child_pid;
string retval;

View File

@ -94,9 +94,9 @@ public:
this->ldh_line_attrs.clear();
}
else {
log_format *format = this->ldh_file->get_format();
auto format = this->ldh_file->get_format();
struct line_range body;
string_attrs_t &sa = this->ldh_line_attrs;
auto& sa = this->ldh_line_attrs;
this->ldh_line_attrs.clear();
this->ldh_line_values.clear();

View File

@ -54,7 +54,7 @@ public:
ldt_parent_column_count(0),
ldt_instance(-1) {
std::shared_ptr<logfile> lf = lss.find(template_line);
log_format *format = lf->get_format();
auto format = lf->get_format();
this->vi_supports_indexes = false;
this->ldt_format_impl = lvm.lookup_impl(format->get_name());
@ -68,10 +68,10 @@ public:
struct line_range body;
string_attrs_t sa;
std::vector<logline_value> line_values;
log_format *format = lf->get_format();
auto format = lf->get_format();
shared_buffer_ref line;
if (this->ldt_format_impl != NULL) {
if (this->ldt_format_impl != nullptr) {
this->ldt_format_impl->get_columns(cols);
}
this->ldt_parent_column_count = cols.size();
@ -200,7 +200,7 @@ public:
int next_column = this->ldt_parent_column_count;
this->ldt_format_impl->extract(lf, line_number, line, values);
values.emplace_back(instance_name, this->ldt_instance, lf->get_format());
values.emplace_back(instance_name, this->ldt_instance, lf->get_format().get());
logline_value &lv = values.back();
lv.lv_column = next_column++;
for (auto &ldt_pair : this->ldt_pairs) {
@ -218,7 +218,7 @@ public:
if (sscanf(scan_value, "%lf", &d) != 1) {
d = 0.0;
}
values.emplace_back(intern_string::lookup("", 0), d, lf->get_format());
values.emplace_back(intern_string::lookup("", 0), d, lf->get_format().get());
}
break;

View File

@ -56,7 +56,7 @@ string_attr_type logline::L_OPID("opid");
string_attr_type logline::L_META("meta");
external_log_format::mod_map_t external_log_format::MODULE_FORMATS;
std::vector<external_log_format *> external_log_format::GRAPH_ORDERED_FORMATS;
std::vector<std::shared_ptr<external_log_format>> external_log_format::GRAPH_ORDERED_FORMATS;
struct line_range logline_value::origin_in_full_msg(const char *msg, ssize_t len) const
{
@ -224,9 +224,9 @@ std::string logline_value::to_string() const
return std::string(buffer);
}
vector<log_format *> log_format::lf_root_formats;
vector<std::shared_ptr<log_format>> log_format::lf_root_formats;
vector<log_format *> &log_format::get_root_formats()
vector<std::shared_ptr<log_format>> &log_format::get_root_formats()
{
return lf_root_formats;
}
@ -706,7 +706,7 @@ log_format::scan_result_t external_log_format::scan(logfile &lf,
while (::next_format(this->elf_pattern_order, curr_fmt, pat_index)) {
auto fpat = this->elf_pattern_order[curr_fmt];
pcrepp *pat = fpat->p_pcre;
auto& pat = fpat->p_pcre;
if (fpat->p_module_format) {
continue;
@ -735,13 +735,13 @@ log_format::scan_result_t external_log_format::scan(logfile &lf,
ts->length(),
this->get_timestamp_formats(),
&log_time_tm,
log_tv)) == NULL) {
log_tv)) == nullptr) {
this->lf_date_time.unlock();
if ((last = this->lf_date_time.scan(ts_str,
ts->length(),
this->get_timestamp_formats(),
&log_time_tm,
log_tv)) == NULL) {
log_tv)) == nullptr) {
continue;
}
}
@ -837,16 +837,16 @@ uint8_t external_log_format::module_scan(const pcre_input &pi,
uint8_t mod_index;
body_cap->ltrim(pi.get_string());
pcre_input body_pi(pi.get_substr_start(body_cap), 0, body_cap->length());
vector<external_log_format *> &ext_fmts = GRAPH_ORDERED_FORMATS;
auto& ext_fmts = GRAPH_ORDERED_FORMATS;
pcre_context_static<128> pc;
module_format mf;
for (auto elf : ext_fmts) {
for (auto& elf : ext_fmts) {
int curr_fmt = -1, fmt_lock = -1;
while (::next_format(elf->elf_pattern_order, curr_fmt, fmt_lock)) {
auto fpat = elf->elf_pattern_order[curr_fmt];
pcrepp *pat = fpat->p_pcre;
auto& pat = fpat->p_pcre;
if (!fpat->p_module_format) {
continue;
@ -862,7 +862,7 @@ uint8_t external_log_format::module_scan(const pcre_input &pi,
elf->lf_mod_index);
mod_index = elf->lf_mod_index;
mf.mf_mod_format = (external_log_format *) elf->specialized(curr_fmt).release();
mf.mf_mod_format = elf->specialized(curr_fmt);
MODULE_FORMATS[mod_name] = mf;
return mod_index;
@ -1458,10 +1458,11 @@ void external_log_format::build(std::vector<std::string> &errors) {
}
if (!this->lf_timestamp_format.empty()) {
this->lf_timestamp_format.push_back(NULL);
this->lf_timestamp_format.push_back(nullptr);
}
try {
this->elf_filename_pcre = new pcrepp(this->elf_file_pattern);
this->elf_filename_pcre =
std::make_shared<pcrepp>(this->elf_file_pattern);
}
catch (const pcrepp::error &e) {
errors.push_back("error:" +
@ -1478,7 +1479,7 @@ void external_log_format::build(std::vector<std::string> &errors) {
}
try {
pat.p_pcre = new pcrepp(pat.p_string);
pat.p_pcre = std::make_unique<pcrepp>(pat.p_string);
}
catch (const pcrepp::error &e) {
errors.push_back("error:" +
@ -1606,7 +1607,7 @@ void external_log_format::build(std::vector<std::string> &errors) {
for (auto &elf_level_pattern : this->elf_level_patterns) {
try {
elf_level_pattern.second.lp_pcre = new pcrepp(
elf_level_pattern.second.lp_pcre = std::make_shared<pcrepp>(
elf_level_pattern.second.lp_regex.c_str());
}
catch (const pcrepp::error &e) {
@ -2041,7 +2042,7 @@ public:
return false;
}
log_format *format = lf->get_format();
auto format = lf->get_format();
this->elt_module_format.mf_mod_format = nullptr;
if (format->get_name() == this->lfvi_format.get_name()) {
@ -2089,7 +2090,7 @@ public:
shared_buffer_ref &line,
std::vector<logline_value> &values)
{
log_format *format = lf->get_format();
auto format = lf->get_format();
if (this->elt_module_format.mf_mod_format != nullptr) {
shared_buffer_ref body_ref;
@ -2120,9 +2121,9 @@ std::shared_ptr<log_vtab_impl> external_log_format::get_vtab_impl() const
return std::make_shared<external_log_table>(*this);
}
std::unique_ptr<log_format> external_log_format::specialized(int fmt_lock)
std::shared_ptr<log_format> external_log_format::specialized(int fmt_lock)
{
auto retval = std::make_unique<external_log_format>(*this);
auto retval = std::make_shared<external_log_format>(*this);
retval->lf_specialized = true;
this->lf_pattern_locks.clear();

View File

@ -269,7 +269,7 @@ public:
/**
* @return The collection of builtin log formats.
*/
static std::vector<log_format *> &get_root_formats();
static std::vector<std::shared_ptr<log_format>> &get_root_formats();
/**
* Template used to register log formats during initialization.
@ -279,15 +279,13 @@ public:
public:
register_root_format()
{
static T format;
log_format::lf_root_formats.push_back(&format);
log_format::lf_root_formats.push_back(std::make_shared<T>());
};
};
static log_format *find_root_format(const char *name) {
std::vector<log_format *> &fmts = get_root_formats();
for (auto lf : fmts) {
static std::shared_ptr<log_format> find_root_format(const char *name) {
auto& fmts = get_root_formats();
for (auto& lf : fmts) {
if (lf->get_name() == name) {
return lf;
}
@ -375,7 +373,7 @@ public:
return nullptr;
};
virtual std::unique_ptr<log_format> specialized(int fmt_lock = -1) = 0;
virtual std::shared_ptr<log_format> specialized(int fmt_lock = -1) = 0;
virtual std::shared_ptr<log_vtab_impl> get_vtab_impl() const {
return nullptr;
@ -447,7 +445,7 @@ public:
bool lf_time_ordered{true};
bool lf_specialized{false};
protected:
static std::vector<log_format *> lf_root_formats;
static std::vector<std::shared_ptr<log_format>> lf_root_formats;
struct pcre_format {
pcre_format(const char *regex) : name(regex), pcre(regex) {

View File

@ -88,7 +88,7 @@ public:
struct pattern {
std::string p_config_path;
std::string p_string;
pcrepp *p_pcre{nullptr};
std::unique_ptr<pcrepp> p_pcre;
std::vector<indexed_value_def> p_value_by_index;
std::vector<int> p_numeric_value_indexes;
int p_timestamp_field_index{-1};
@ -102,12 +102,11 @@ public:
struct level_pattern {
std::string lp_regex;
pcrepp *lp_pcre{nullptr};
std::shared_ptr<pcrepp> lp_pcre;
};
external_log_format(const intern_string_t name)
: elf_file_pattern(".*"),
elf_filename_pcre(NULL),
elf_column_count(0),
elf_timestamp_divisor(1.0),
elf_level_field(intern_string::lookup("level", -1)),
@ -168,7 +167,7 @@ public:
return true;
};
std::unique_ptr<log_format> specialized(int fmt_lock);
std::shared_ptr<log_format> specialized(int fmt_lock);
const logline_value_stats *stats_for_value(const intern_string_t &name) const {
const logline_value_stats *retval = nullptr;
@ -345,12 +344,12 @@ public:
typedef std::map<intern_string_t, module_format> mod_map_t;
static mod_map_t MODULE_FORMATS;
static std::vector<external_log_format *> GRAPH_ORDERED_FORMATS;
static std::vector<std::shared_ptr<external_log_format>> GRAPH_ORDERED_FORMATS;
std::set<std::string> elf_source_path;
std::list<intern_string_t> elf_collision;
std::string elf_file_pattern;
pcrepp *elf_filename_pcre;
std::shared_ptr<pcrepp> elf_filename_pcre;
std::map<std::string, std::shared_ptr<pattern>> elf_patterns;
std::vector<std::shared_ptr<pattern>> elf_pattern_order;
std::vector<sample> elf_samples;
@ -437,7 +436,7 @@ private:
class module_format {
public:
external_log_format *mf_mod_format{nullptr};
std::shared_ptr<log_format> mf_mod_format;
};
#endif

View File

@ -210,9 +210,9 @@ class generic_log_format : public log_format {
sa.emplace_back(lr, &SA_BODY);
};
unique_ptr<log_format> specialized(int fmt_lock)
shared_ptr<log_format> specialized(int fmt_lock)
{
return unique_ptr<log_format>(new generic_log_format(*this));
return std::make_shared<generic_log_format>(*this);
};
};
@ -680,10 +680,8 @@ public:
return retval;
};
std::unique_ptr<log_format> specialized(int fmt_lock = -1) {
std::unique_ptr<bro_log_format> retval = make_unique<bro_log_format>(*this);
return unique_ptr<log_format>(retval.release());
std::shared_ptr<log_format> specialized(int fmt_lock = -1) {
return make_shared<bro_log_format>(*this);
};
class bro_log_table : public log_format_vtab_impl {

View File

@ -61,7 +61,7 @@ using namespace std;
static void extract_metadata(const char *contents, size_t len, struct script_metadata &meta_out);
typedef map<intern_string_t, external_log_format *> log_formats_map_t;
typedef map<intern_string_t, std::shared_ptr<external_log_format>> log_formats_map_t;
static log_formats_map_t LOG_FORMATS;
@ -77,9 +77,10 @@ static external_log_format *ensure_format(const yajlpp_provider_context &ypc, us
vector<intern_string_t> *formats = ud->ud_format_names;
external_log_format *retval;
retval = LOG_FORMATS[name];
retval = LOG_FORMATS[name].get();
if (retval == nullptr) {
LOG_FORMATS[name] = retval = new external_log_format(name);
LOG_FORMATS[name] = std::make_shared<external_log_format>(name);
retval = LOG_FORMATS[name].get();
log_debug("Loading format -- %s", name.get());
}
retval->elf_source_path.insert(ud->ud_format_path.filename().string());
@ -946,9 +947,9 @@ void load_formats(const std::vector<ghc::filesystem::path> &extra_paths,
uint8_t mod_counter = 0;
vector<external_log_format *> alpha_ordered_formats;
vector<std::shared_ptr<external_log_format>> alpha_ordered_formats;
for (auto iter = LOG_FORMATS.begin(); iter != LOG_FORMATS.end(); ++iter) {
external_log_format *elf = iter->second;
auto& elf = iter->second;
elf->build(errors);
if (elf->elf_has_module_format) {
@ -961,7 +962,7 @@ void load_formats(const std::vector<ghc::filesystem::path> &extra_paths,
continue;
}
external_log_format *check_elf = check_iter.second;
auto& check_elf = check_iter.second;
if (elf->match_samples(check_elf->elf_samples)) {
log_warning("Format collision, format '%s' matches sample from '%s'",
elf->get_name().get(),
@ -975,15 +976,14 @@ void load_formats(const std::vector<ghc::filesystem::path> &extra_paths,
}
}
vector<external_log_format *> &graph_ordered_formats =
external_log_format::GRAPH_ORDERED_FORMATS;
auto& graph_ordered_formats = external_log_format::GRAPH_ORDERED_FORMATS;
while (!alpha_ordered_formats.empty()) {
vector<intern_string_t> popped_formats;
for (auto iter = alpha_ordered_formats.begin();
iter != alpha_ordered_formats.end();) {
external_log_format *elf = *iter;
auto elf = *iter;
if (elf->elf_collision.empty()) {
iter = alpha_ordered_formats.erase(iter);
popped_formats.push_back(elf->get_name());
@ -998,7 +998,7 @@ void load_formats(const std::vector<ghc::filesystem::path> &extra_paths,
bool broke_cycle = false;
log_warning("Detected a cycle...");
for (auto elf : alpha_ordered_formats) {
for (const auto& elf : alpha_ordered_formats) {
if (elf->elf_builtin_format) {
log_warning(" Skipping builtin format -- %s",
elf->get_name().get());
@ -1027,7 +1027,7 @@ void load_formats(const std::vector<ghc::filesystem::path> &extra_paths,
log_info(" %s", graph_ordered_format->get_name().get());
}
vector<log_format *> &roots = log_format::get_root_formats();
auto &roots = log_format::get_root_formats();
roots.insert(roots.begin(), graph_ordered_formats.begin(), graph_ordered_formats.end());
}
@ -1145,7 +1145,7 @@ void find_format_scripts(const vector<ghc::filesystem::path> &extra_paths,
void load_format_vtabs(log_vtab_manager *vtab_manager,
std::vector<std::string> &errors)
{
map<intern_string_t, external_log_format *> &root_formats = LOG_FORMATS;
auto &root_formats = LOG_FORMATS;
for (auto & root_format : root_formats) {
root_format.second->register_vtabs(vtab_manager, errors);

View File

@ -138,7 +138,7 @@ log_search_table::extract(std::shared_ptr<logfile> lf, uint64_t line_number,
{
int next_column = 0;
values.emplace_back(instance_name, this->lst_instance, lf->get_format());
values.emplace_back(instance_name, this->lst_instance, lf->get_format().get());
values.back().lv_column = next_column++;
for (int lpc = 0; lpc < this->lst_regex.get_capture_count(); lpc++) {
auto cap = this->lst_match_context[lpc];

View File

@ -139,7 +139,7 @@ public:
shared_buffer_ref &line,
std::vector<logline_value> &values)
{
log_format *format = lf->get_format();
auto format = lf->get_format();
this->vi_attrs.clear();
format->annotate(line_number, line, this->vi_attrs, values, false);
@ -178,7 +178,7 @@ public:
return false;
}
log_format *format = lf->get_format();
auto format = lf->get_format();
if (format->get_name() == this->lfvi_format.get_name()) {
return true;
} else if (mod_id && mod_id == this->lfvi_format.lf_mod_index) {

View File

@ -162,9 +162,8 @@ bool logfile::process_prefix(shared_buffer_ref &sbr, const line_info &li)
}
else if (this->lf_options.loo_detect_format &&
this->lf_index.size() < MAX_UNRECOGNIZED_LINES) {
vector<log_format *> &root_formats =
log_format::get_root_formats();
vector<log_format *>::iterator iter;
auto &root_formats = log_format::get_root_formats();
vector<std::shared_ptr<log_format>>::iterator iter;
/*
* Try each scanner until we get a match. Fortunately, all the formats
@ -178,7 +177,7 @@ bool logfile::process_prefix(shared_buffer_ref &sbr, const line_info &li)
}
(*iter)->clear();
this->set_format_base_time(*iter);
this->set_format_base_time(iter->get());
found = (*iter)->scan(*this, this->lf_index, li, sbr);
if (found == log_format::SCAN_MATCH) {
#if 0

View File

@ -162,7 +162,7 @@ public:
* @return The detected format, rebuild_index() must be called before this
* will return a value other than NULL.
*/
log_format *get_format() const { return this->lf_format.get(); };
std::shared_ptr<log_format> get_format() const { return this->lf_format; };
text_format_t get_text_format() const {
return this->lf_text_format;
@ -382,7 +382,7 @@ protected:
std::string lf_basename;
std::string lf_content_id;
struct stat lf_stat;
std::unique_ptr<log_format> lf_format;
std::shared_ptr<log_format> lf_format;
std::vector<logline> lf_index;
time_t lf_index_time{0};
off_t lf_index_size{0};

View File

@ -192,7 +192,7 @@ void logfile_sub_source::text_value_for_line(textview_curses &tc,
this->lss_token_shift_start = 0;
this->lss_token_shift_size = 0;
log_format *format = this->lss_token_file->get_format();
auto format = this->lss_token_file->get_format();
value_out = this->lss_token_value;
if (this->lss_flags & F_SCRUB) {

View File

@ -1406,7 +1406,7 @@ static void save_session_with_id(const std::string session_id)
if (lpc == LNV_LOG) {
for (auto format : log_format::get_root_formats()) {
auto *elf = dynamic_cast<external_log_format *>(format);
auto *elf = dynamic_cast<external_log_format *>(format.get());
if (elf == nullptr) {
continue;
@ -1526,7 +1526,7 @@ void reset_session()
lnav_data.ld_filter_view.reload_data();
lnav_data.ld_files_view.reload_data();
for (auto format : log_format::get_root_formats()) {
auto *elf = dynamic_cast<external_log_format *>(format);
auto *elf = dynamic_cast<external_log_format *>(format.get());
if (elf == nullptr) {
continue;

View File

@ -125,7 +125,7 @@ int main(int argc, char *argv[])
retval = EXIT_FAILURE;
}
else {
unique_ptr<log_format> format;
shared_ptr<log_format> format;
char *log_line;
bool found = false;
char cmd[2048];
@ -146,8 +146,8 @@ int main(int argc, char *argv[])
sbr.share(share_manager, (char *)sub_line.c_str(), sub_line.size());
vector<log_format *> &root_formats = log_format::get_root_formats();
vector<log_format *>::iterator iter;
auto &root_formats = log_format::get_root_formats();
vector<std::shared_ptr<log_format>>::iterator iter;
vector<logline> index;
if (is_log) {

View File

@ -41,9 +41,9 @@
using namespace std;
std::vector<log_format *>& log_format::get_root_formats()
std::vector<std::shared_ptr<log_format>>& log_format::get_root_formats()
{
static std::vector<log_format *> retval;
static std::vector<std::shared_ptr<log_format>> retval;
return retval;
}