Skip to content

Commit e4dc62d

Browse files
committed
Standardize log outputs on console.
1 parent b61b374 commit e4dc62d

File tree

2 files changed

+18
-31
lines changed

2 files changed

+18
-31
lines changed

lib/logstash/filters/elastic_integration.rb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -476,36 +476,23 @@ def check_versions_alignment
476476

477477
if es_major_version > plugin_major_version
478478
logger.warn <<~WARNING
479-
this plugin v#{VERSION} is connected to a newer MAJOR version of
480-
Elasticsearch v#{es_full_version}, and may have trouble loading or
481-
running pipelines that use new features; for the best experience,
482-
update this plugin to at least v#{es_major_version}.#{es_minor_version}
479+
This plugin v#{VERSION} is connected to a newer MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version}
483480
WARNING
484481
elsif es_major_version < plugin_major_version
485482
logger.warn <<~WARNING
486-
this plugin v#{VERSION} is connected to an older MAJOR version of
487-
Elasticsearch v#{es_full_version}, and may have trouble loading or
488-
running pipelines that use features that were deprecated before
489-
Elasticsearch v#{plugin_major_version}.0; for the best experience,
490-
align major/minor versions across the Elastic Stack.
483+
This plugin v#{VERSION} is connected to an older MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use features that were deprecated before Elasticsearch v#{plugin_major_version}.0; for the best experience, align major/minor versions across the Elastic Stack.
491484
WARNING
492485
elsif es_minor_version > plugin_minor_version
493486
logger.warn <<~WARNING
494-
this plugin v#{VERSION} is connected to a newer MINOR version of
495-
Elasticsearch v#{es_full_version}, and may have trouble loading or
496-
running pipelines that use new features; for the best experience,
497-
update this plugin to at least v#{es_major_version}.#{es_minor_version}
487+
This plugin v#{VERSION} is connected to a newer MINOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version}
498488
WARNING
499489
elsif es_minor_version < plugin_minor_version
500490
logger.info <<~INFO
501-
this plugin v#{VERSION} is connected to an older MINOR version of
502-
Elasticsearch v#{es_full_version}; for the best experience,
503-
align major/minor versions across the Elastic Stack.
491+
This plugin v#{VERSION} is connected to an older MINOR version of Elasticsearch v#{es_full_version}; for the best experience, align major/minor versions across the Elastic Stack.
504492
INFO
505493
else
506494
logger.debug <<~DEBUG
507-
this plugin v#{VERSION} is connected to the same MAJOR/MINOR version
508-
of Elasticsearch v#{es_full_version}.
495+
This plugin v#{VERSION} is connected to the same MAJOR/MINOR version of Elasticsearch v#{es_full_version}.
509496
DEBUG
510497
end
511498
end

spec/unit/elastic_integration_spec.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@
743743

744744
it "informs which version of ES the plugin is built from" do
745745
expected_message =
746-
"this plugin v#{version} is connected to the same MAJOR/MINOR version\n" +
746+
"This plugin v#{version} is connected to the same MAJOR/MINOR version " +
747747
"of Elasticsearch v#{connected_es_version_info['number']}.\n"
748748

749749
expect(mock_logger).to have_received(:info).with(base_message)
@@ -767,39 +767,39 @@
767767

768768
context "plugin major version is behind" do
769769
let(:expected_message) {
770-
"this plugin v#{version} is connected to a newer MAJOR version of\n" +
771-
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or\n" +
772-
"running pipelines that use new features; for the best experience,\n" +
770+
"This plugin v#{version} is connected to a newer MAJOR version of " +
771+
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or " +
772+
"running pipelines that use new features; for the best experience, " +
773773
"update this plugin to at least v#{connected_es_version_info['major']}.#{connected_es_version_info['minor']}\n"
774774
}
775775
include_examples "version mismatch", :major, :behind, :info, :warn
776776
end
777777

778778
context "plugin major version is ahead" do
779779
let(:expected_message) {
780-
"this plugin v#{version} is connected to an older MAJOR version of\n" +
781-
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or\n" +
782-
"running pipelines that use features that were deprecated before\n" +
783-
"Elasticsearch v#{plugin_major_version}.0; for the best experience,\n" +
780+
"This plugin v#{version} is connected to an older MAJOR version of " +
781+
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or " +
782+
"running pipelines that use features that were deprecated before " +
783+
"Elasticsearch v#{plugin_major_version}.0; for the best experience, " +
784784
"align major/minor versions across the Elastic Stack.\n"
785785
}
786786
include_examples "version mismatch", :major, :ahead, :info, :warn
787787
end
788788

789789
context "plugin minor version is behind" do
790790
let(:expected_message) {
791-
"this plugin v#{version} is connected to a newer MINOR version of\n" +
792-
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or\n" +
793-
"running pipelines that use new features; for the best experience,\n" +
791+
"This plugin v#{version} is connected to a newer MINOR version of " +
792+
"Elasticsearch v#{connected_es_version_info['number']}, and may have trouble loading or " +
793+
"running pipelines that use new features; for the best experience, " +
794794
"update this plugin to at least v#{connected_es_version_info['major']}.#{connected_es_version_info['minor']}\n"
795795
}
796796
include_examples "version mismatch", :minor, :behind, :info, :warn
797797
end
798798

799799
context "plugin minor version is ahead" do
800800
let(:expected_message) {
801-
"this plugin v#{version} is connected to an older MINOR version of\n" +
802-
"Elasticsearch v#{connected_es_version_info['number']}; for the best experience,\n" +
801+
"This plugin v#{version} is connected to an older MINOR version of " +
802+
"Elasticsearch v#{connected_es_version_info['number']}; for the best experience, " +
803803
"align major/minor versions across the Elastic Stack.\n"
804804
}
805805
include_examples "version mismatch", :minor, :ahead, :info, :info

0 commit comments

Comments
 (0)