diff options
Diffstat (limited to '')
-rw-r--r-- | src/session.export.cc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/session.export.cc b/src/session.export.cc index d408c50..75550d1 100644 --- a/src/session.export.cc +++ b/src/session.export.cc @@ -42,6 +42,7 @@ struct log_message_session_state { bool lmss_mark; nonstd::optional<std::string> lmss_comment; nonstd::optional<std::string> lmss_tags; + nonstd::optional<std::string> lmss_annotations; std::string lmss_hash; }; @@ -57,7 +58,8 @@ struct from_sqlite<log_message_session_state> { from_sqlite<bool>()(argc, argv, argi + 2), from_sqlite<nonstd::optional<std::string>>()(argc, argv, argi + 3), from_sqlite<nonstd::optional<std::string>>()(argc, argv, argi + 4), - from_sqlite<std::string>()(argc, argv, argi + 5), + from_sqlite<nonstd::optional<std::string>>()(argc, argv, argi + 5), + from_sqlite<std::string>()(argc, argv, argi + 6), }; } }; @@ -178,9 +180,12 @@ export_to(FILE* file) static auto& lnav_db = injector::get<auto_sqlite3&>(); static const char* BOOKMARK_QUERY = R"( -SELECT log_time_msecs, log_format, log_mark, log_comment, log_tags, log_line_hash +SELECT log_time_msecs, log_format, log_mark, log_comment, log_tags, log_annotations, log_line_hash FROM all_logs - WHERE log_mark = 1 OR log_comment IS NOT NULL OR log_tags IS NOT NULL + WHERE log_mark = 1 OR + log_comment IS NOT NULL OR + log_tags IS NOT NULL OR + log_annotations IS NOT NULL )"; static const char* FILTER_QUERY = R"( @@ -267,7 +272,6 @@ SELECT content_id, format, time_offset FROM lnav_file const auto& open_opts = name_pair.second; if (!open_opts.loo_is_visible || !open_opts.loo_include_in_session - || open_opts.loo_temp_file || open_opts.loo_source != logfile_name_source::USER) { continue; @@ -320,13 +324,15 @@ SELECT content_id, format, time_offset FROM lnav_file FMT_STRING(";UPDATE all_logs " "SET log_mark = {}, " "log_comment = {}, " - "log_tags = {} " + "log_tags = {}, " + "log_annotations = {} " "WHERE log_time_msecs = {} AND " "log_format = {} AND " "log_line_hash = {}\n"), lmss.lmss_mark ? "1" : "0", sqlitepp::quote(lmss.lmss_comment).in(), sqlitepp::quote(lmss.lmss_tags).in(), + sqlitepp::quote(lmss.lmss_annotations).in(), lmss.lmss_time_msecs, sqlitepp::quote(lmss.lmss_format).in(), sqlitepp::quote(lmss.lmss_hash).in()); @@ -431,14 +437,15 @@ SELECT content_id, format, time_offset FROM lnav_file level_names[min_level]); } - struct timeval min_time, max_time; char tsbuf[128]; - if (lss->get_min_log_time(min_time)) { - sql_strftime(tsbuf, sizeof(tsbuf), min_time, 'T'); + auto min_time_opt = lss->get_min_log_time(); + if (min_time_opt) { + sql_strftime(tsbuf, sizeof(tsbuf), min_time_opt.value(), 'T'); fmt::print(file, FMT_STRING(":hide-lines-before {}\n"), tsbuf); } - if (lss->get_max_log_time(max_time)) { - sql_strftime(tsbuf, sizeof(tsbuf), max_time, 'T'); + auto max_time_opt = lss->get_max_log_time(); + if (max_time_opt) { + sql_strftime(tsbuf, sizeof(tsbuf), max_time_opt.value(), 'T'); fmt::print(file, FMT_STRING(":hide-lines-after {}\n"), tsbuf); } for (const auto& ld : *lss) { |