[log_formats] change "no patterns have a capture" error to a warning

This commit is contained in:
Tim Stack 2022-09-10 15:43:47 -07:00
parent 132bd0adba
commit af5213a98a
4 changed files with 23 additions and 13 deletions

7
NEWS
View File

@ -4,6 +4,13 @@ lnav v0.11.1:
instead of an empty string for the `capture_name` column if
the capture is not named.
Fixes:
* Reduce the "no patterns have a capture" error to a warning
so that it doesn't block lnav from starting up.
Cost of Doing Business:
* Migrated from pcre to pcre2.
lnav v0.11.0:
Features:
* Redesigned the top status area to allow for user-specified

View File

@ -2312,8 +2312,9 @@ SELECT tbl_name FROM sqlite_master WHERE sql LIKE 'CREATE VIRTUAL TABLE%'
load_config(lnav_data.ld_config_paths, config_errors);
if (!config_errors.empty()) {
print_user_msgs(config_errors);
return EXIT_FAILURE;
if (print_user_msgs(config_errors) != EXIT_SUCCESS) {
return EXIT_FAILURE;
}
}
add_global_vars(ec);
@ -2420,8 +2421,9 @@ SELECT tbl_name FROM sqlite_master WHERE sql LIKE 'CREATE VIRTUAL TABLE%'
auto format_list = load_format_file(src_path, loader_errors);
if (!loader_errors.empty()) {
print_user_msgs(loader_errors);
return EXIT_FAILURE;
if (print_user_msgs(loader_errors) != EXIT_SUCCESS) {
return EXIT_FAILURE;
}
}
if (format_list.empty()) {
lnav::console::print(
@ -2611,9 +2613,10 @@ SELECT tbl_name FROM sqlite_master WHERE sql LIKE 'CREATE VIRTUAL TABLE%'
load_format_vtabs(lnav_data.ld_vtab_manager.get(), loader_errors);
if (!loader_errors.empty()) {
print_user_msgs(loader_errors);
if (mmode_ops == nullptr) {
return EXIT_FAILURE;
if (print_user_msgs(loader_errors) != EXIT_SUCCESS) {
if (mmode_ops == nullptr) {
return EXIT_FAILURE;
}
}
}

View File

@ -1932,7 +1932,7 @@ external_log_format::build(std::vector<lnav::console::user_message>& errors)
VC_ROLE.value(role_t::VCR_SYMBOL),
", ");
errors.emplace_back(
lnav::console::user_message::error(
lnav::console::user_message::warning(
attr_line_t("invalid value ")
.append_quoted(lnav::roles::symbol(
fmt::format(FMT_STRING("/{}/value/{}"),

View File

@ -111,12 +111,12 @@
std  = “^(?<timestamp>\d+): (?<pid>\w+) (?<body>.*)$”
with-level = “^(?<timestamp>\d+)\| (?<level>\w+) (?<body>\w+)$”
✘ error: invalid value “/invalid_props_log/value/non-existent”
reason: no patterns have a capture named “non-existent”
⚠ warning: invalid value “/invalid_props_log/value/non-existent”
reason: no patterns have a capture named “non-existent”
 --> {test_dir}/bad-config/formats/invalid-properties/format.json:4
 = note: the following captures are available:
body, pid, timestamp
 = help: values are populated from captures in patterns, so at least one pattern must have a capture with this value name
 = note: the following captures are available:
body, pid, timestamp
 = help: values are populated from captures in patterns, so at least one pattern must have a capture with this value name
✘ error: invalid tag definition “/invalid_props_log/tags/badtag”
reason: tag definitions must have a non-empty pattern
 --> {test_dir}/bad-config/formats/invalid-properties/format.json:4